html - CSS: provide initial width and expand based on content -
is there way main div have initial width of 1024px able expand based on content if content longer 1024px?
also, possible contents dynamic, if content longer 1024px, main div must expand accommodate content. if content smaller 1024, should remain 1024px centered on screen.
html
<div id="main"> <h1>title</h1> <div id="othercontent"> <!-- other content here --> </div> </div> css
#main { width: 1024px; margin: 0 auto; } here fiddle examples (examples based on 600px instead of 1024px)
edit: main div centered using margin.
#main { min-width: 1024px; }
Comments
Post a Comment