Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / December 2005



Tip: Looking for answers? Try searching our database.

IE's max-width hack not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David R - 21 Dec 2005 22:06 GMT
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?
thierry38080 - 22 Dec 2005 10:53 GMT
David R a écrit :

> Hi
>
[quoted text clipped - 56 lines]
>
> 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...
thierry38080 - 27 Dec 2005 09:54 GMT
thierry38080 a écrit :

> David R a écrit :
>
[quoted text clipped - 64 lines]
>
> Doing that, it seems to work on IE 6...

Did you try this ?
Did it work ???
Spartanicus - 27 Dec 2005 10:26 GMT
[Pointless full quote removed]

followed by:

>Did you try this ?
>Did it work ???

Please learn to trim quotes down to the bare minimum.

Signature

Spartanicus

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.