Brav Posted May 31, 2010 Share Posted May 31, 2010 I have one large div (used as container) and a few smaller in that div. Smaller divs have defined width, and width of container is based on the sum of smaller divs. Is there some way to define div so he could automatically crop it self to match resolution of the screen (div is 1381px width), or i must redefine picture used for div? Link to comment Share on other sites More sharing options...
holmedwa04 Posted May 31, 2010 Share Posted May 31, 2010 Surely the container div can be 100% so it will resize to the size of the browser window and then the other divs presumably float on top of the container div?So the code for the container div would be: container.div {width: 100%} And then the code for the other divs you already have. Link to comment Share on other sites More sharing options...
Brav Posted May 31, 2010 Author Share Posted May 31, 2010 Well that does not work (hole structure just collapse into chaos). Link to comment Share on other sites More sharing options...
thescientist Posted May 31, 2010 Share Posted May 31, 2010 if the div's are floated in the container, then they will not take up any space, and thus your div will collapse. you could add overflow: auto to the container div. or create another div that's not floated, put it after the floated elements in the HTML, and give it clear: both in the CSS. Link to comment Share on other sites More sharing options...
Brav Posted June 2, 2010 Author Share Posted June 2, 2010 Here is the site the is exactly like my idea: http://www.mortalonline.com/?. Background picture is in the centar, and side scroll will not appear until you came to the central div. How to make this effect? Link to comment Share on other sites More sharing options...
thescientist Posted June 2, 2010 Share Posted June 2, 2010 i don't know what you mean about the side scroll thing, but what have you tried yourself to achieve the effect? A div will take up the available width of the space its in. So you can either set that to be a percentage or a whole number in pixels. It looks like they're using a fixed width container centered on the page. Link to comment Share on other sites More sharing options...
Brav Posted June 2, 2010 Author Share Posted June 2, 2010 Just found the solution , and it was simple one body { margin:0; padding:0; width:100%; background-attachment: fixed; background-color: #2C3127; background-image: url(../Ripped%20World/Sajt/Images/BazaWide_02.png); background-repeat: no-repeat; background-position: center top;}html { padding:0; margin:0;} This will make background image, and it will be allways centered, and with the center div it will make a hole image. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.