Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    layers - catch 22 or is there a way around it

    If I use percentage to define width of a layer etc and make the browsers width narrower the content shrinks but if I use pixels and make the browsers width narrower the content doesnt shrink. I want to use percentages so appearance will be centered on all types of monitors.

    e.g.
    Code:
    <div id="PageLocation" style="position:absolute; width:70%; left: 15%; height:50px; z-index:1; background-color:#990000; top: 200px;">Page location Page location Page location Page location Page location Page location</div>
    if i make the browser narrow it will appear like

    Page location
    Page location
    Page location
    Page location etc

    instead of Page location Page location Page location Page location etc

    Is there a way of stopping this?

    P.S have attached current code with layout
    Attached Files Attached Files

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    You can use min-width:

    Code:
    #container {
     min-width :20em; /* adjust to the necessary width */
    }
    IE doesn't support this but IE7 will; for IE6 you can use this javascript.

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    min-width works well, tried the javascript for IE but doesnt seem to work. anyone know any reasons why.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    We need to see your code for us to tell you why. You should also read this thread. http://www.codingforums.com/showthread.php?t=97590
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Mar 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is my CSS
    Code:
    /* CSS Document */
    
    body
    {
     background-color:#EEEEEE; 
    }
    
    #heading 
    {
      position:absolute; 
      width:70%; 
      left: 15%; 
      min-width:44em; 
      max-width:50em; 
      min-height:100%; 
      z-index:1; 
      height:100px; 
      background-color:#00CC00; 
      top: 50px;
      overflow:auto;
    }
    
    #links
    {
    	position:absolute; 
    	width:70%; left: 15%; 
    	min-width:44em; 
    	max-width:50em; 
    	min-height:100%; 
    	z-index:1; 
    	height:50px;
    	background-color:#003366; 
    	top: 150px;
    }
    
    #page_location
    {
    	position:absolute; 
    	width:70%; 
    	left: 15%; 
    	min-width:44em; 
    	max-width:50em; 
    	min-height:100%; 
    	z-index:1; 
    	height:50px;
    	background-color:#990000; top: 200px;
    	overflow:visible;
    }
    
    
    
    #main
    {
    	position:absolute;
    	width:70%;
    	left: 15%; 
    	min-width:44em; 
    	max-width:50em; 
    	min-height:100%; 
    	z-index:1; 
    	height:400px;
    	background-color:#9900CC;
    	top: 250px;
    }
    
    #end
    {
    	position:absolute; 
    	width:70%; 
    	left: 15%; 
    	min-width:44em; 
    	max-width:50em; 
    	min-height:100%; 
    	z-index:1; 
    	height:50px;
    	background-color:#FFFF00;
    	top: 650px;
    }
    
    #end_border
    {
    	position:absolute; 
    	width:70%;
    	left: 15%;
    	min-width:44em; 
    	max-width:50em; 
    	min-height:100%; 
    	z-index:1; 
    	height:50px;
    	background-color:#EEEEEE; 
    	top: 700px;
    }
    This is my index page layout:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="cssfile.css">
    </head>
    <script type="text/javascript" src="minmax.js"></script>
    <body>
    <div id="heading">heading</div>    <!-- heading -->
    
    <div id="links">links</div>            <!-- links layer -->
    
    <div id="page_location">             <!-- page location info layer -->
    Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page
    </div>
    
    <div id="main">MAIN</div>         <!-- main content -->
    
    <div id="end">End</div>          <!-- end -->
    
    <div id="end_border"></div>       <!-- end border -->
    </body>
    </html>
    the JavaScript i got from the link above doesnt seem to be working for IE6

    is there any other way of stopping the shrinking other than something like
    Code:
    * html #main{width:800px};

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Did you read that thread?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Mar 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah had a read thru it got the
    Code:
    * html #main{width:683px};
    from it. that works. it just means my page isnt exaclty centered if i view it on my laptop.
    i picked up the container div from the thread. Should i be using one.
    Also should i be using this bit of code.
    Code:
    <!--[if lte IE 6]>
    		<style type="text/css">
    		#outer { padding-left: 900px; float: left; }
    		#inner { margin-left: -900px; }
    		#container { position: relative; width: 100%; }
    		#content { width: 630px; height: 100%;}
    		#right { width: 225px; }
    		</style>
    	<![endif]-->

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You read the wrong thing. Yes the thing above is a variation of what you should be using. http://www.pmob.co.uk/temp/min-width-ie.htm (view the source).
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    New Coder
    Join Date
    Mar 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have it working
    added:
    Code:
    <!--[if IE]>
    <style type="text/css">
    #inner{padding-left:1000px;float:left;}
    #content{margin-left:-1000px;}
    </style>
    <![endif]-->
    to my code.

    thanks fir the help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •