Wednesday 11 July 2012

Minimum width for a page


Minimum width for a page

A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.


Unfortunately, IE doesn't understand this command, so we'll need to come up with a new way of making this work in this browser. First, we'll insert a <div> under the <body> tag, as we can't assign a minimum width to the <body>:


<body>
<div id="container">



Next we create our CSS commands, so as to create a minimum width of 600px:


#container
{
min-width: 600px;
width:expression(document.body.clientWidth < 600? "600px": "auto" );
}



The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note though, this command will cause your CSS document to invalidate so you may prefer to insert it into the head of each HTML document to get round this.


You might also want to combine this minimum width with a maximum width:


#container
{
min-width: 600px;
max-width: 1200px;
width:expression(document.body.clientWidth < 600? "600px" : document.body.clientWidth > 1200? "1200px" : "auto");






BUDDY CHECK OUT THESE ALSO : ALL LEARNING THING , HTML , CSS , WEB FORMS ,DREAM WEAVERDTD , JAVAJAVA SCRIPT , SQL , MY SQL  , PL-SQL , PHOTOSHOP , C + + , C  , WEB PAGES , MAYAPDF FILES , EVERYTHING AVAILABLE , AJAX  , HYBERNATE , WSDL  , WAP , RUBY ON RAILS , SCALA , HTTP , HTML 5 , PROTOTYPE , Wi-MAX , FLASH , WML , RUBY , PERL ,UNIX , DLL , RSS , RADIUS , UNIX SOCKET , PYTHON , JSP , SOAP , MVC , DOT NET , PHP , ADO , ASP , J QUERY , TCP/IP , VISUAL BASIC , UML , VISUAL STUDIO , GPRS....


1 comment:

  1. Please visit http://enginegearclutch.blogspot.in/ ,here u can find all about CSS and mechanical things

    ReplyDelete