View Full Version : Can I put my elements into some fixed-width container in the center of the page?

The Noob Coder
08-08-2012, 01:05 AM
I have a few simple elements (some spans, p's, text box, etc.) that I want to put into a container and center in the middle of the page.

I'd like the container to be of a fixed width, such that as the content changes, the container never gets any wider or narrower. I'll have things sliding up and down with jQuery in this box and the box should get taller or shorter based on what appears inside it, but not wider. Is all this possible?

If this seems too vague, please feel free to ask for a clarification.

08-08-2012, 06:16 AM
something like this.

<div class="container">
<p>stuff here</p>
<span> sjaf ;ljkjl jl </span>

.container { width:700px; margin:0 auto; }

The Noob Coder
08-08-2012, 09:23 PM
Thank you very much. This worked out quite nicely! :thumbsup: