www.webdeveloper.com
Results 1 to 6 of 6

Thread: Help for HTML code for page width please.

  1. #1
    Join Date
    Apr 2006
    Posts
    29

    Help for HTML code for page width please.

    Hello, I know that the html data that you put on your page is kind of a no brainer regarding how the length, of the page can go on as long as you choose.

    I need some html code that sets up the width of the page. The last website I had did this for me automatically.

    What is the html code to set up the width of a web page. Thanks very much! Butch

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,923
    This should be done via CSS. Typically a set of <div>...</div> tags are used to contain the entire page contents, then a fixed or percentage width is assigned to that div in your stylesheet.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    As an example of how to set the content width - I use the following CSS on my site:

    #content {margin:2% auto;width:94%;width:540px%;min-width:570px;max-width:850px;text-align:left;}

    This centres the content with a width of 94% of the available width for Internet Explorer, a width of 540 pixels for webTV (which has a fixed width of 544 pixels). For other browsers it also uses 94% of the available width provided that the content doesn't end up narrower than 570 pixels or wider than 850 pixels in which case that width is used instead. This keeps the width of the content to an acceptable range in most browsers with only IE (before version 7) allowing the content to become too wide or too narrow).
    Stephen

  4. #4
    Join Date
    Apr 2006
    Posts
    29
    Stephen, I've seen some of your other posts, you seem to know how to do a lot of this stuff. Thanks.

    Someone else told me this...Maximum width = 560 pixels so pages print properly and various screen size and properties allow easy viewing. (That if I make the pages wider than 560 pixels, the pages won't print properly in some printers, or I can take the chance of cutting off the scroll bar in some browsers? Any truth to this? Thanks Butch.

  5. #5
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Unless the printer has been set up with very wide margins then I have found that somewhere in the low 700s will fit across an A4 page (letter sized paper is slightly wider so A4 is the limiting factor for international printing).

    Also you can easily set up an alternate stylesheet with media=print" that redefines your page layout completely for printing. You could even create two complete sets of content for the page and hide one set on the screen and the other on the printer so that the printed page is completely different from what displays on the screen.
    Stephen

  6. #6
    Join Date
    Apr 2006
    Posts
    29
    Thanks a lot, trying to avoid setting up any seperate print parameters for each page. If I use 700 you think that will cover all basis? If I use 700 do I still need to use your percentage numbers along with it? Butch

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles