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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -