I have a circle created using CSS, as you can see below:
.circle {
width: 40px;
height: 40px;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
text-align: center;
margin-left:auto;
margin-right:auto;
color: #555555;
line-height: 40px;
font-weight: bold;
border: 4px solid #333;
}
How can I create a shadow/brightness around this circle using CSS, as you can see in the sample image below?
Thanks in advance!
box-shadow is what you want. Add this to your .circle class:
box-shadow: 0 0 30px #FFE8AE;
See https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow for more details about the various properties.
You can use the box-shadow property which respects the border-radius property.
Something like this jsFiddle
box-shadow: 0 0 1em #FFD800;
Try the box-shadow property:
box-shadow:0px 0px 10px 10px #faa;
jsFiddle example
Related
I am not able to make a shadow gradient background for one image described in the following snippet. I have tried various solutions but couldn't make it to work. The image gets cut off from bottom.
.circle {
line-height: 0.33;
border-radius: 100%;
background: #fff;
color: #FFF;
box-shadow: 1px 5px 20px #adadad;
}
<img class="circle" src="https://i.stack.imgur.com/4kEf0.png">
Please check out the below solution. I hope this helps.
.circle {
display: inline-block;
line-height: 0.33;
border-radius: 100%;
background: #fff;
color: #FFF;
box-shadow: 1px 5px 20px #adadad;
}
<div class="circle">
<img src="https://i.stack.imgur.com/4kEf0.png">
</div>
Please let me know if this helps.
Here's my take on your problem, i'm not sure what you wanted it to look like but this solution doesn't make the "x2" appear outside.
You need to wrap your image in a div bigger than the image if you want a circle border to contain the whole image. Adding border-radius basically makes a square border smaller, therefore covering your image.
.circle-border {
text-align: center;
width: 450px;
height: 430px;
line-height: 0.33;
border-radius: 100%;
background: #fff;
color: #FFF;
box-shadow: 1px 5px 20px #adadad;
}
<div class="circle-border">
<img class="circle" src="https://i.stack.imgur.com/4kEf0.png">
</div>
.circle-border {
display: inline-block;
line-height: 0.33;
border-radius: 100%;
background: #fff;
color: #FFF;
box-shadow: 1px 5px 20px #adadad;
}
<div class="circle-border">
<img src="https://i.stack.imgur.com/4kEf0.png">
</div>
I am trying to create a <kbd> tag for myself. I was trying with this image like below,
CSS:
kbd {
font-family: Courier;
padding-top:8px;
padding-bottom:8px;
padding-right:15px;
padding-left:10px;
background: url('kbd.png');
background-repeat:no-repeat;
}
HTML:
<p>Open Terminal <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>T</kbd> </p>
But images are not showing completely unless the text is large enough to cover the image. see the screen shot below.
Also I could not able to bring the text at center, I tried align but could not succeeded.
Any help including any better way to have <kbd> tag will be appreciated.
It's very worth noting that this could be done pretty much entirely without the need of an image. It would be more flexible without it; a long <kbd> text would break if it were an image, but wouldn't if it was done entirely in CSS.
So I propose:
http://jsfiddle.net/TLV4a/1/
kbd {
display: inline-block;
min-width: 45px;
text-align: center;
font-family: Courier;
margin: 0 5px;
padding: 0 5px;
background-color: #f7f7f7;
border-width: 1px 1px 3px;
border-style: solid;
border-color: #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: inset 0 0 4px 1px #fff;
box-shadow: inset 0 0 4px 1px #fff;
line-height: 1.75;
}
If you have even padding, instead of different left vs. right padding, as well as utilise a min-width along with text-align: center;, you can get it to display nicely.
http://jsfiddle.net/TLV4a/
kbd {
display: inline-block;
min-width: 50px;
text-align: center;
font-family: Courier;
padding: 6px 5px 8px;
background: url('https://dl.dropboxusercontent.com/u/61772690/kbd.png') no-repeat 50% 0;
}
Have a look at this jsFiddle
kbd {
font-family: Courier;
padding-top:6px;
padding-bottom:6px;
background: url('https://dl.dropboxusercontent.com/u/61772690/kbd.png');
display: inline-block;
width: 54px;
text-align: center;
background-repeat:no-repeat;
}
You can use this code to get your desire resutl:
kbd {
background: url("kbd.png") no-repeat;
display: inline-block;
font-family: Courier;
min-height: 31px;
min-width: 54px;
font-size: 0.75em;
padding: 6px 0 0;
text-align: center;
}
/*use font size to adjust with the key image and use padding 0px for the left and right after that use text-align to obtain your best result .I have attached an image look it*/
Adding background-size may be your best solution.
background-size:100% 100%;
You can use text-align:center for align your text and on the background image you can use a z-index Property.
have a look here for z-index examples:
http://www.w3schools.com/cssref/pr_pos_z-index.asp
I have an box which is an image and I have text inside the image which will be geenrated dynamically.
Please look at the attached screenshot for more information.
How do I make sure that the image stretches when there is more text ?
.my-community-box{
background: url('/assets/my-community-box.png') no-repeat !important;
background-size: 100%;
width: 287px;
min-height: 474px;
float: right;
.my-community-details{
background-color: #mild-gray;
margin: 20px 10px 10px 10px;
padding: 5px;
ul{
width: 250px;
margin: 0 0 9px 0;
li{
}
}
a{
color: #darker-green;
}
a:hover{
text-decoration: none;
color: #light-green;
}
}
Why not use a border?
.my-community-box{
background: #F3F3F2;
width: 287px;
min-height: 474px;
float: right;
border: 3px solid #C5C3C3;
}
.my-community-box-wrap{
border-left: 2px solid #C2E2A0;
border-right: 2px solid #C2E2A0;
float: right;
}
Demo: http://jsfiddle.net/AWXHr/
you will need to background-repeat: repeat-y; the image, but will have to change it. as far as it seems, it is one single image - you will have to crop it to have the top border and the "body" of the image will be the part that you want to vertical repeat.
alternatively, due to the simple design, you could just use css borders
EDIT
also, as a few comments suggested, you should show us some code and not just an image, that would help a lot!
Use css border instead of image
div{
border:#333 solid 6px; border-radius:0 0 6px 6px;
box-shadow: 0px 0px 0px 2pt green;
height:auto;
width:200px;
background:#c1c1c1
}
Demo http://jsfiddle.net/wYUFD/12/
Demo
Hi now used to background-size:cover; or max-width
as like this
p{
max-width:200px;
border:solid 10px red;
background:url('http://www.gravatar.com/avatar/eb71f65106648cf6618b10423e8b0451?s=32&d=identicon&r=PG') no-repeat;
background-size:cover;
color:#fff;
}
Demo
I hope this may be helpful to you
.my-community-details{
background-color: #mild-gray;
margin: 20px 10px 10px 10px;
padding: 5px;
max-width: //set what depends up on your image width
max-height: //set what depends up on your image height
overflow-y: auto;
The new twitter-bootstrap docs have a nice interface for delimiting examples.
How do I get this same effect, but within the well?
My attempt: http://jsfiddle.net/YdusM/
How about that: jsFiddle
Apply .well:before {...} instead .corner_text:before {...}
UPDATE:
Apply 'example element' for specific well-block: jsFiddle
Instead of applying :before to outer div. I made it to .well and adjusted the padding top and left to -20px..
ie
.well:before {
position: relative;
content: "Example";
top: -20px;
left: -20px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
background-color: #f5f5f5;
border: 1px solid #ddd;
color: #9da0a4;
-webkit-border-radius: 4px 0 4px 0;
-moz-border-radius: 4px 0 4px 0;
border-radius: 4px 0 4px 0;
}
Check the fiddle http://jsfiddle.net/YdusM/7/
You can just inspect the code in the docs, and you wil find this css, applied to the exmaple wrapper:
.bs-docs-example::after {
content: "Example";
position: absolute;
top: -1px;
left: -1px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
background-color: whiteSmoke;
border: 1px solid #DDD;
color: #9DA0A4;
-webkit-border-radius: 4px 0 4px 0;
-moz-border-radius: 4px 0 4px 0;
border-radius: 4px 0 4px 0;
}
Add something similar as a custom class to your css, or you could even do it in less to use the bootstrap variables and mixins. If you want the text to be addaptable, it would perhaps be better to forget about the :after and adapt this styling a bit to apply it to a specific element holding the text you want and place it inside the wrapper.
edit:
For the positioning to work, you should set the wrapper to position: relative; as well. Not sure what you are after, but i updated your fiddle to demonstrate: http://jsfiddle.net/YdusM/9/
It is easiest to describe this problem with pictures. How it is meant to look (works in Firefox):
firefox
In Chrome and Safari the insides of the border are square for some reason:
chrome
Here is my CSS:
.header {
width: 850px;
margin-left: auto;
margin-right: auto;
background-color: #F7F7F7;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
border-radius: 40px 40px 40px 40px;
border: 20px solid rgba(255,255,255,0.1);
-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;
margin-top: 20px;
}
Any ideas?
EDIT - here is a jfiddle of it: jsfiddle.net/oliverw92/pJgyu/11262/
It's a known Webkit and Opera bug: https://bugs.webkit.org/show_bug.cgi?id=23166
Until it's fixed, your only way around it is using 2 elements I'm afraid...
If you remove the alpha from the border, it works. Since you probably don't want to do that, you may be able to use two nested elements. Example here.
I think this is normal Webkit behavior when clipping to the box's padding. The padding is square, i.e., not defined by the border's curves, and so the background color overlays portions of the border.
Try this instead (via a SPAN nested inside your DIV):
CSS:
body {
background-color: #999;
}
.header {
width: 400px;
margin-left: auto;
margin-right: auto;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
border-radius: 40px 40px 40px 40px;
border: 20px solid rgba(255,255,255,0.1);
margin-top: 20px;
height: 85px;
font-weight: 100;
font-size: 70px;
vertical-align: middle;
text-align: center;
}
.header span
{
background-color: #F7F7F7;
display: inline-block;
width:100%;
border-radius: 20px 20px;
}
HTML:
<div class="header">
<span>DataLog</span>
</div>
Side Note: Aside from your code, I didn't bother adding all the vendor prefixes; I'll leave that to you.
Or you can just use a box-shadow and adjust the top margin. My example only includes the -web-kit versions
.header {
width: 400px;
margin-left: auto;
margin-right: auto;
background-color: #F7F7F7;
-webkit-border-radius: 40px;
-webkit-box-shadow: 0px 0px 0px 20px rgba(255,255,255,0.10);
margin-top: 40px;
height: 85px;
font-weight: 100;
font-size: 70px;
vertical-align: middle;
text-align: center;
}
Here is a similar JSFiddle to your first example using only your original div
I have been experiencing a similar issue. It turned out that because the container inside the container that i have added with the border-radius has a background-colour, it covers the inside of the border.
To rectify this i have added a border-radius to the child object as well as it makes it look the same.