Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    Dec 2010
    Posts
    414
    Thanks
    22
    Thanked 55 Times in 55 Posts
    something like this.

    Code:
    <div class="container">
          <p>stuff here</p>
          <span> sjaf ;ljkjl jl  </span>
    </div>
    
    .container { width:700px; margin:0 auto; }

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    80
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you very much. This worked out quite nicely!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •