I'm interested to find which way of creating box shadows with css is most effective. But that I mean : ease of implementation, flexibility, and cross browser compatibility.
Onion skinning is my personal favorite.
An example can be found in this alistapart article.
This is now very simple to achieve:
box-shadow: 3px 3px 3px rgba(0,0,0,0.33);
First value is the horizontal offset.
Second value is vertical offset.
Third value is spread of blur effect.
Fourth Value is color.
Additionally, you can add another value of inset, which will make the shadow appear on the inside of you block element:
box-shadow: 3px 3px 3px rgba(0,0,0,0.33) inset;
This is now very well supported: https://caniuse.com/#feat=css-boxshadow
The way I find most effective currently is this:
The CSS rules needed :
.shadow{
position:relative;
display:block;
background-color:#bbb;
border:1px solid black;
}
.shadowed_item{
position:relative;
border:1px solid black;
background-color:white;
top:-5px;
left:-5px;
}
HTML code on which the CSS is applied:
<div class='shadow'>
<div class='shadowed_item'>I have a shadow.</div>
</div>
I found it very simple to implement, flexible and it works the same on FF 3, IE 6 & 7.
Related
I am using CSS after (very cool thing) to generate a "popup" that works far, far better than title does, usually.
I have a problem with IE (surprise, surprise), where a popup, mediated using CSS's after thingy, is showing up perfectly in Chrome, but renders quite badly in IE 11.
Versus in Chrome:
The css is like this:
*[data-holiday]::after{
background:#fefdcd;
border:1px solid #c0c0c0;
box-shadow:2px 4px 5px rgba(0, 0, 0, 0.4);
color:black;
content:attr(data-holiday);
display:block;
font-size:0.8rem;
left: 50px;
line-height:1.0rem;
position:absolute;
/* opacity:0; */
top:10px;
padding:2px 2px;
pointer-events:none;
width:160px;
z-index:100;
}
with markup providing the content for "data-holiday"
<div style="position:absolute;top:0px;right:160px;font-size:0.8rem;" data-holiday="[content for display here]">
NOTE: opacity was temporarily commented out, to get the screen captures. OnHover is used in css to modify this ordinarily.
Usually I can sort out how to hand-hold IE, but this time I have no clues. Any one see what I'm missing?
I tried putting br's in the text, made no difference. FYI, the content is just plain text, no formatting, no HTML.
Thanks
I faced a very interesting fact, and hope you have an answer for that.
I have this code:
width:940px; margin:0 auto; padding:13px 29px 39px 31px; background:#fff;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
-webkit-box-shadow:0 0 2px 1px #e3e6e9;
-moz-box-shadow:0 0 2px 1px #e3e6e9;
box-shadow:0 0 2px 1px #e3e6e9;
I saw it on Joomla 1.6 template - and it works cool on IE8, but when I pasted the same code to my template, it doesn't work on IE8, maybe there are some tricks to accomplish that?
Thanks in advance
Internet explorer doesn't support border-radius and box-shadow. There are some projects that try to bring css3 to ie like css3pie or ie-css3. Of course for shadows you can use filters. Read more here.
As others mentioned, that code doesn't work on IE8. Most likely there is a IE8 only stylesheet that uses images to get the same effect.
Personally I just let IE8 and below be a little blocky if I can get away with it. The % of users on those browsers is diminishing fast and I don't mind helping that along. And if your rounded corners are subtle then it's not something many users would even notice. Same goes for box shadow.
I am designing home page of my domain registration website and I am stuck at one place. Please go through the website at http://a2host.in/
In Firefox and Google Chrome the Search and Go Button are in same alignment with the text and select box but in Opera and IE8, they are falling down a bit.
I have tried out all the things but I am not able to figure out the actual problem.
I see a lot of unneccesary styling. In essence, this is what you want:
Basic form without floats
You can tweak the font-sizes and colors here, until you have what you want. But this is a good starting point, because it is cross browser identical.
Also, think about using the <button> element instead of the <input type="button">. It gives you more freedom in styling.
Form-controls are a pain to get them look good in all browsers, especially buttons and select-boxes.
Please comment out the following CSS3 properties (please see below) in the .regbutton class of your stylesheet and then try
.regbutton, .regbutton:visited {
background: #222 url(/getImage.php?src=myUploadedImages/overlay.png) repeat-x;
display: inline-block;
padding: 5px 10px 6px;
color: #fff;
text-decoration: none;
/*-moz-border-radius: 6px;*/ /*comment out all CSS3 properties*/
/*-webkit-border-radius: 6px;*/
/*-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);*/
/*-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);*/
/*text-shadow: 0 -1px 1px rgba(0,0,0,0.25);*/
/*border-bottom: 1px solid rgba(0,0,0,0.25);*/
position: relative;
cursor: pointer;
}
try to set border:none for your buttons
What's the easiest way to create drop shadows around div boxes? A print media designer sent me this example design:
http://glacialsummit.com/shadow.jpg
As you can see, the drop shadow seems to "glow" around the div box. Is this easy to re-create with CSS? Or should I tell the designer it's impractical to create this?
Yes, it is possible, even in IE6.
It is possible with CSS3. But the browsers still use their own CSS property names.
Yes, it is possible with CSS3. Here is the sample:
selector {
-moz-box-shadow: 5px 5px 10px #666;
-webkit-box-shadow: 5px 5px 10px #666;
box-shadow: 5px 5px 10px #666;
}
Would work in most of major browsers except IE.
Here is the explain:
selector {
box-shadow: x-coordinate y-coordinate blur-radius color;
}
Cheers.
i used this corner style:
.corners4{
background:url(../img/panelHeaderColor.jpg) repeat-x;
-moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px;
-moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px;
-moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px;
}
but, this doesn't work in IE, is there any IE equivalent for this?
thanks
If you remove the -moz- part of the property, you will have border-radius-topleft and so on. These are the border-radius properties. These are only in the CSS3 standard. With IE's current track record, CSS3 should be supported sometime around 2017. If you want it to work in Safari, you can use -webkit-border-radius. See this question for more information on rounded corners.
The -moz- part stands for "Mozilla" - this property is not supported by IE.
There is no CSS only equivalent for this that works across all browsers. At least not yet.
Curved corners are a serious pain in the behind to implement with javascript, and most solutions aren't very robust. The absolute best way to achieve this in a way all your users will be able to enjoy is the old school way of using your own images as corners, unfortunately. This website makes the process easier, at least. If you want to venture into JS solutions, I've heard good things about curvyCorners.
IE seems to be tricky with rounded corners a lot of times. All in all, you will find it isn't supported very well, and there are still plenty of users going back to IE5.5 or so. I would recommend a different approach.
While I don't remember exactly where I learned it, I can give you the code I have on my website.
HTML Code that goes before your element:
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
HTML Code that comes after your element
<b class="b4"></b><b class="b3"></b><b class="b2"></b><b class="b1"></b>
CSS Code:
.b1, .b2, .b3, .b4{font-size:1px; overflow:hidden; display:block;}
.b1 {height:1px; background: #000; margin:0 4px;}
.b2 {height:1px; background: #fff; border-right:2px solid #000; border-left:2px solid #000; margin:0 2px;}
.b3 {height:1px; background: #fff; border-right:1px solid #000; border-left:1px solid #000; margin:0 1px;}
.b4 {height:2px; background: #fff; border-right:1px solid #000; border-left:1px solid #000; margin:0 0px;}
The above CSS code, the #000 is going to be your border color. The #FFF is going to be
the color of your content box.
You will want to have no top and no bottom border on your content block, but then set the left and right border to be 1px and then the color you want the border to be.
Depending on your current implementation this may seem somewhat not as nice looking, and feel free to add more b tags applying the same logic to get a bigger radius. If you would like a larger radius and can't figure it out, just let me know and I'll extend this to be larger.
One final note, depending on where you are placing these you may have to tweek the margin settings a bit.
Check this site: http://border-radius.com/ it generats css for WebKit, Gecko, CSS3.
Example:
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
The corner radius issue of IE gonna solve.
http://kbala.com/ie-9-supports-corner-radius/