I have a line of CSS that acts differently in IE than it does for every other browsers. I want this line to look like this in all browsers:
.header-ie .wrapper-ie:after {
position:absolute;
bottom:-33px;
width:100%;
height:34px;
content:"";
left:0;
background:url(../shadow-bg.png) no-repeat center;
background-size:100% auto;
pointer-events:none
}
I want it to look like this in IE (9 or lower):
.header-ie .wrapper-ie:after{
position:absolute;
bottom:-250px;
width:100%;
height:34px;
content:"";
left:0;
background-size:100% auto;
pointer-events:none
}
How can I accomplish this in my style sheet?
In your HTML page, you can implement a conditional CSS file. Call this after you have called you other stylesheet(s).
<link rel="stylesheet" href="/style/site.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" href="/style/ie-legacy.css" />
<![endif]-->
You may need to decorate the classes attributes in the ie-legacy.css with an !important.
NOTE: IE9 (and lower) will no longer receive security or feature updates from Microsoft after January 12, 2016.
If you only want to change 1 or 2 things, you can use per-propery hack:
From: http://codemug.com/html/css-hacks-for-ie6ie7ie8ie9-and-ie10/
#hack{
color:red; /* All browsers */
color:red !important;/* All browsers but IE6 */
_color:red; /* Only works in IE6 */
*color:red; /* IE6, IE7 */
+color:red;/* Only works in IE7*/
*+color:red; /* Only works in IE7 */
color:red\9; /* IE6, IE7, IE8, IE9 */
color:red\0; /* IE8, IE9 */
color:red\9\0;/*Only works in IE9*/
}
So you'll end up with
.header-ie .wrapper-ie:after {
position:absolute;
bottom:-33px;
bottom:-250px\9;
width:100%;
height:34px;
content:"";
left:0;
background:url(../shadow-bg.png) no-repeat center;
background:none\9;
background-size:100% auto;
pointer-events:none
}
Related
I am trying to apply width for .container class but ie is not taking any changes of css.If any body have any idea let me know.Bellow is my code.
<!-- [if ie 9]>
.nav > li > a{
padding-left: 20px !important;
}
.container{
max-width: 1350px !important;
width: 1350px !important;
}
<![endif]-->
My website link
Conditional comments are meant to be used in the html markup, not the css. (See here for usage)
There are hacks for css to target ie9, such as as /9 or ... this:
/* target Internet Explorer 9 and Internet Explorer 10:*/
#media screen and (min-width:0\0) {
/* ie9+ code here */
...
}
Check this example FIDDLE in IE9+ and other browsers
Yet again Internet Explorer is costing me time and money.
I'm making a responsive site and I'm needing my images to be no more than 100% width of their containing elements, but also no more than a certain percentage height in case they fall off the page.
Some CSS:
#content{
margin:0 auto;
min-width:320px;
max-width:800px;
width:80%;
background-color:green;
}
#featured{
position:relative;
width:100%;
}
#featured-images{
text-align:center;
}
#featured-images img{
max-height:80%;
height:auto !important; /* IE fix */
height:80%; /* IE fix */
max-width:100%;
width:auto !important; /* IE fix */
width:100%; /* IE fix *
}
Some Markup:
<div id="content">
<div id="featured">
<div id="featured-images">
<img src="lib/imgs/fi-1.jpg"/>
</div>
</div>
</div>
Currently, this page works on Chrome. It even works in IE6, and IE8+. I haven't tested it in Firefox or Opera. But IE 7 definitely doesn't play ball. It seems to shrink the image to quite a small degree, as if the browser has been resized to a stump.
I know it's not ideal, but I've been using IE NetRenderer to test.
Its fixed, you can check it here:
<style type="text/css">
#content {
margin:0 auto;
min-width:320px;
max-width:800px;
width:80%;
background-color:green;
}
#featured {
position:relative;
width:100%;
}
#featured-images {
text-align:center;
}
#featured-images img {
max-height:100%;
max-width:100%;
height:auto;
width:auto;
}
</style>
<div id="content">
<div id="featured">
<div id="featured-images">
<img src="https://www.google.co.in/images/srpr/logo4w.png" />
</div>
</div>
</div>
Or here Fiddle http://jsfiddle.net/Fqebe/1/
Cheers!
Internet Explorer Conditional Comment Style Sheet...
http://www.jabcreations.com/web/css/ieccss
Works without JavaScript enabled.
No need for hacks, if IE requires the wrong values (e.g. height/width) instead of what you use then only the versions of IE you need to apply those pseudo-right values to will work.
That will let you keep all the IE-related nastiness out of your main style sheet and you can use a specific IECCSS per version of IE.
I tested on Chrome, Opera, even Internet Explorer, my below css works as expected.
.carousel
{
position:relative;
overflow:hidden;
width:100%;
margin-bottom:0px;
}
.carousel-inner
{
font-size:0;
position:absolute;
width:6882px;
}
.carousel-item
{
background-repeat:no-repeat;
background-position:0px 0px;
display:inline-block;
cursor:pointer;
margin:0px 16px;
}
But when I tested on Firefox, .carousel-inner is not hiding overflowing element.
In order to add the same effect, I need to add float:left to .carousel-inner, which renders width:100% to be ignored.
Is there another work around specific to Firefox?
I tried clear:both with no luck.
Here is jsfiddle example
And image (Chrome, IE, Opera) :
Firefox :
Cheers !
how can i use 2 image for the body the first background will be at the top with no repeat , the second image will be after the first one with repeat , in Firefox i can do that easily but my problem in IE
Attach one to html and another to body -
html{
background: url() repeat-y left top;
}
body{
background: url() no-repeat left top;
}
It's possible to add multiple backgrounds in IE using a proprietary filter
As taken from the linked site, the IE code is as follows:
<!--[if gt IE 7]>
<style type="text/css">
/* The proprietary zoom property gives IE the hasLayout property which addresses several bugs, dont forget to insert your wrappers id */
#outerWrapper #contentWrapper, #outerWrapper #contentWrapper #content {
zoom: 1;
}
/* Now lets make it IE8 Multi-background images */
#multipleBackgroundImages {
background-image: url(../images/lilys.jpg);
background-position: bottom right;
background-repeat: no-repeat;
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/lakeside2.png', sizingMethod='crop')";
border: 1px solid black;
padding: 0 1em;
}
/* Fix for IE clearType */
#multipleBackgroundImages p {
position: relative; /* required to re-enable IE's clearType */
}
</style>
<![endif]-->
Use the below code. This supports all browsers including IE
body{
width:800px; height:750px;
background: url(http://www.google.com/logos/2012/indonesiaind12-hp.jpg), url(http://www.google.com/logos/2012/india12-hp.jpg);
background-position:top, bottom;
background-repeat:no-repeat, no-repeat
}
You can get the detailed explanation here
use nested div's and apply one background for one and another for another
<div class="background-bottom"><div class="background-top"></div></div>
Its Simple you have to split the body into two seperate div's in that you can do that easily. top div and bottom div must have those two images as their background.
It may work in IE
body
{
padding:0px;
background:#2786f4;
position:relative;
margin:0;
color:#818181;
text-align:center;
}
<!--[if IE]>
<style>
#Right
{
width:202px;
background:#f1f1f1;
padding:8px;
position:absolute;
top:130px;
left:945px;
float:right;
text-align:left;
}
</style>
<![endif]-->
<div id="Right" >
sadlf ljas dfjlsdjflsfjsl a;sldjf ;slfj
</div>
I am facing a positioning problem while creating a HTML. It looks okay in all browsers except Opera.
How it will okay in Opera too ?
You have a conditional comment that only works in IE. In IE, I see a light grey box on the right with the text in it.
All other browsers (Opera, Firefox Chrome) don't see the style for #Right and thus don't apply it. So they just show the grey text at the top.
It's not clear what you want to do, but if you want to hide that text completely from non-IE browsers, move the <div> inside the conditional comment, i.e. before <![endif]-->.