CSS Expressions
CSS expressions used to work in older IE's, but they have been completely abandoned in IE8:
Dynamic properties (also called "CSS expressions") are no longer supported in Internet Explorer 8 and later, in IE8 Standards mode and higher. This decision was made for standards compliance, browser performance, and security reasons, as detailed in the IE blog entry titled Ending Expressions. Dynamic properties are still available in Internet Explorer 8 in either IE7 mode or IE5 mode.
So it's arguably not really worth learning them any more.
If not, what should I use?
Depending on the use case, JavaScript or media queries.
As @Yet Another Geek notes, your above example can be implemented using position: fixed
. IE6 doesn't support that - the CSS expression was probably created to work around that.
Avoid CSS expressions
YSlow claims that you have an inline style, so at least it is not from a css file. If you can't find the <style>
in your own html, something else is adding this to your code.
This could maybe an external JavaScript, or maybe it comes from an browser extension you added, e.g a developer tool.
In your browser debug console type document.getElementsByTagName("style")
to list all <style>
in your generated document
Replacement for css expression
expression()
is a non-standard feature. It does not exist in any level of CSS. It's an old IE specific feature that has been removed from newer versions of IE, and is not coming back.
Since expression()
is nothing more than a bridge between JavaScript and CSS, the simplest solution is to write the equivalent JavaScript. Exactly what the equivalent code looks like will probably depend on your layout.
css expression :not with two condition
I believe you can just chain the :not
selector like this:
div#container > div:not(.show):not(.about)
{
display: none;
}
It appears to work correctly on this fiddle.
set the body height width css expressions
div.tall_top
does not show up because your body,html
does not have a height.
Set the height to 100%
html,body {
margin:0;
width:100%;
height:100%;
background:blue;
}
Demo: http://jsfiddle.net/codef0rmer/3x6fh/2/
Related Topics
CSS Property as SASS Mixin Value
How Does One Use the Onerror Attribute of an Img Element
Base64 Encoded Image Is Not Showing in Gmail
Bootstrap 4 - Responsive Cards in Card-Columns
How to Hide Table Row Overflow
Center an Image Horizontally Using CSS
How to Prevent Text in a Table Cell from Wrapping
Easiest Way to Extract the Urls from an HTML Page Using Sed or Awk Only
Why Does Vw Include the Scrollbar as Part of the Viewport
What Makes the Text on a <Button> Element Vertically Centered
CSS Custom Cursor Doesn't Work in Ff/Chrome
Form Inline Inside a Form Horizontal in Twitter Bootstrap
How to Justify a Horizontal List
Is There Any Benefit to Adding Accept-Charset="Utf-8" to HTML Forms, If the Page Is Already in Utf-8