SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Fixed Width Content within a 100% div

    Hi Guys

    Please see:

    http://www.highlycreative.co.uk/test...uts/test11.htm

    If I want the main text content to take up a fixed width within the main 100% div, what technique should I use?

    What fixed width is it best to use?

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    May 2006
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, so I've added a new div called textcontent and given it the following CSS:

    #textcontent {
    margin:0px auto;
    width: 960px;
    background-color: #FFCCCC;
    }

    Is that it? Is 960px the best width to use?

    Thanks

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,598
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by accelerator View Post
    Code:
    #textcontent {
    	margin:0px auto;
    	width: 960px;
    	background-color: #FFCCCC;
    }
    Is that it?
    Yes, that's fine.

    Is 960px the best width to use?
    Best for what? The web is really meant to be a flexible medium—adaptable to all sorts of environments like small screens etc.—so the ideal is probably to have a flexible width, such as width: 80%;

  4. #4
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,225
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Or, you might want to try {max-width:960px}. It narrows to fit the window width, too.

    Different behaviors. Pick one that suits your fancy. There really is no "best".


Bookmarks

Posting Permissions

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