473,383 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

IE's max-width hack not working

Hi

Following Sven Tofte's guide about implementing max-width in IE
(http://www.svendtofte.com/code/max_width_in_ie/), I tried this out:

-------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<style type="text/css">

#Masthead {
height: 120px;
border: 1px solid green; }

#Content {
/* position: relative;
top: -15px; */

border: 1px solid red;

max-width: 800px;
width: expression(document.body.clientWidth > 800? "800px": "auto" ); }

</style>
</head>
<body>

<div id="Masthead">

</div>

<div id="Content">

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent nec
ante a ligula imperdiet faucibus. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Quisque dui. Morbi mauris felis,
adipiscing at, congue a, volutpat dapibus, velit. Cras ornare. Cras
bibendum. Phasellus rutrum justo nec lorem. Vivamus ornare. Suspendisse
elementum, purus eget auctor commodo, urna enim laoreet urna, aliquet
ultrices lorem est eget orci. Cras convallis. Suspendisse potenti.
Etiam dictum, sem vitae tincidunt sollicitudin, mauris erat sodales
velit, vitae aliquet erat orci eu velit. Etiam libero nibh, scelerisque
consectetuer, semper ut, eleifend in, mauris. Proin interdum ipsum eu
ipsum. Sed malesuada. Nam pretium nulla non ante. Quisque vehicula
vehicula orci. Aenean justo erat, pellentesque ac, aliquet at, lacinia
non, enim. Sed iaculis metus vitae risus.</p>

</div>
</body>
</html>
------------------------------------------

but when I resize the browser window below 800px width, the element isn't
resized.

Any ideas why?

Dec 21 '05 #1
3 3548

David R a écrit :
Hi

Following Sven Tofte's guide about implementing max-width in IE
(http://www.svendtofte.com/code/max_width_in_ie/), I tried this out:

-------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<style type="text/css">

#Masthead {
height: 120px;
border: 1px solid green; }

#Content {
/* position: relative;
top: -15px; */

border: 1px solid red;

max-width: 800px;
width: expression(document.body.clientWidth > 800? "800px": "auto" ); }

</style>
</head>
<body>

<div id="Masthead">

</div>

<div id="Content">

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent nec
ante a ligula imperdiet faucibus. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Quisque dui. Morbi mauris felis,
adipiscing at, congue a, volutpat dapibus, velit. Cras ornare. Cras
bibendum. Phasellus rutrum justo nec lorem. Vivamus ornare. Suspendisse
elementum, purus eget auctor commodo, urna enim laoreet urna, aliquet
ultrices lorem est eget orci. Cras convallis. Suspendisse potenti.
Etiam dictum, sem vitae tincidunt sollicitudin, mauris erat sodales
velit, vitae aliquet erat orci eu velit. Etiam libero nibh, scelerisque
consectetuer, semper ut, eleifend in, mauris. Proin interdum ipsum eu
ipsum. Sed malesuada. Nam pretium nulla non ante. Quisque vehicula
vehicula orci. Aenean justo erat, pellentesque ac, aliquet at, lacinia
non, enim. Sed iaculis metus vitae risus.</p>

</div>
</body>
</html>
------------------------------------------

but when I resize the browser window below 800px width, the element isn't
resized.

Any ideas why?


Try to invert the lines for the width and the max-width like this :
width:expression(document.body.clientWidth > 800? "800px": "auto" );
max-width: 800px;

Doing that, it seems to work on IE 6...

Dec 22 '05 #2

thierry38080 a écrit :
David R a écrit :
Hi

Following Sven Tofte's guide about implementing max-width in IE
(http://www.svendtofte.com/code/max_width_in_ie/), I tried this out:

-------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<style type="text/css">

#Masthead {
height: 120px;
border: 1px solid green; }

#Content {
/* position: relative;
top: -15px; */

border: 1px solid red;

max-width: 800px;
width: expression(document.body.clientWidth > 800? "800px": "auto" ); }

</style>
</head>
<body>

<div id="Masthead">

</div>

<div id="Content">

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesentnec
ante a ligula imperdiet faucibus. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Quisque dui. Morbi mauris felis,
adipiscing at, congue a, volutpat dapibus, velit. Cras ornare. Cras
bibendum. Phasellus rutrum justo nec lorem. Vivamus ornare. Suspendisse
elementum, purus eget auctor commodo, urna enim laoreet urna, aliquet
ultrices lorem est eget orci. Cras convallis. Suspendisse potenti.
Etiam dictum, sem vitae tincidunt sollicitudin, mauris erat sodales
velit, vitae aliquet erat orci eu velit. Etiam libero nibh, scelerisque
consectetuer, semper ut, eleifend in, mauris. Proin interdum ipsum eu
ipsum. Sed malesuada. Nam pretium nulla non ante. Quisque vehicula
vehicula orci. Aenean justo erat, pellentesque ac, aliquet at, lacinia
non, enim. Sed iaculis metus vitae risus.</p>

</div>
</body>
</html>
------------------------------------------

but when I resize the browser window below 800px width, the element isn't
resized.

Any ideas why?


Try to invert the lines for the width and the max-width like this :
width:expression(document.body.clientWidth > 800? "800px": "auto" );
max-width: 800px;

Doing that, it seems to work on IE 6...


Did you try this ?
Did it work ???

Dec 27 '05 #3
"thierry38080" <th**************@gmail.com> wrote:

[Pointless full quote removed]

followed by:
Did you try this ?
Did it work ???


Please learn to trim quotes down to the bare minimum.

--
Spartanicus
Dec 27 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Samuel | last post by:
Is there anyway to get IE to cache a redirected image? For example, I have an page with the following: <html><body> <img src=http://site1.com/redir.php?id=12> </body></html> The image is...
2
by: Philipp | last post by:
Dear CSS list reader, IE6 does not support min-height, max-height. Is there a workaround for the following problem? http://www.scentech.ch/public/htmlcss/test1.html The left cell - where is...
1
by: ree32 | last post by:
I know IE doesn't support max height but is there anyway to get around it. As I have a Div which is scrollable. The size of the data varies so when its short I dont want a huge between this div and...
2
by: Fabri | last post by:
I would like to ask you the following: I use Macromedia Dreamweaver as an editor for HTML and Js. It also writes some js functions to simply validate forms. I always used it with no bugs. ...
15
by: greenflame | last post by:
First of all I only have IE for testing. Ok. I have a script that is supposed to show, not evaluate, the indefinite integral of something. When I run the script it just craches IE. I have tried...
9
by: torbs | last post by:
Hi I am creating a page for stretchfilm. In this page you can chose between a short medium and long version of the film at any point in the film. It is in norwegian, but just press play. URL:...
2
by: JimO | last post by:
I know IE doesnt' support a max-height property. I'm just curious, though, if there is a way to stop my #container height from growing every time I put something in it. I've tried to give it an...
1
by: RC | last post by:
I have a simple CSS as tbody { max-height: 30em; overflow: scroll } I got horizontal and vertical scroll bars for the tbody tag in Netscape and Firefox, but IE I got nothing! Any idea? Is IE...
7
by: psybert | last post by:
Hello everyone, Long time lurker, first time poster. I'm a beginner coder, and I've taught myself everything with the help and expertise of users and websites like this one. I normally figure out...
19
by: Eugeny Myunster | last post by:
I know, only simple one: #include <stdio.h> int main() { int min=0,max=0,i,arr; for(i=0;i<12;i++) arr=rand()%31-10; for(i=0;i<12;i++)
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.