Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-08-2012, 12:05 AM   PM User | #1
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Can I put my elements into some fixed-width container in the center of the page?

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.
The Noob Coder is offline   Reply With Quote
Old 08-08-2012, 05:16 AM   PM User | #2
aaronhockey_09
Regular Coder

 
Join Date: Dec 2010
Posts: 411
Thanks: 21
Thanked 55 Times in 55 Posts
aaronhockey_09 is an unknown quantity at this point
something like this.

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

.container { width:700px; margin:0 auto; }
aaronhockey_09 is offline   Reply With Quote
Old 08-08-2012, 08:23 PM   PM User | #3
The Noob Coder
New Coder

 
Join Date: Jul 2012
Posts: 72
Thanks: 1
Thanked 0 Times in 0 Posts
The Noob Coder is an unknown quantity at this point
Thank you very much. This worked out quite nicely!
The Noob Coder is offline   Reply With Quote
Reply

Bookmarks

Tags
container, css, html, sliding

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:25 PM.


Advertisement
Log in to turn off these ads.