CSS max-width: 100% for IE 6 with expression?
I have this css:
.container img {
max-width: 100% !important;
height: auto;
}
Now I need this working for IE 6.
I know you can do:
width: expression(this.width > xxx ? xx : true);
but xxx needs to be a number, not a percentage I believe.
I'm doing max-width: 100% so that the width of the 开发者_运维问答image will not exceed the width of the .container
Any ideas?
Thanks.
Without having tested it, I guess you need to compare the elements (client) width to its parent's. Something like:
width: expression(this.clientWidth > this.parentNode.clientWidth ? this.parentNode.clientWidth + "px" : this.clientWidth + "px");
精彩评论