SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Barnum's Avatar
    Join Date
    Oct 2008
    Posts
    418
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Having the same margin

    How do I keep the same margin on a page? I am using <body leftmargin="170" rightmargin="170"> and I it's wrong but everything I seem to find does not accomplish what I am after. I have blocks of text in tables and of course text not in tables. The text not in tables is not lining up with the tables and it looks out of whack. I sure hope I am explaining myself okay.

    Is there not one simple code that sets it all the same?

  2. #2
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,163
    Mentioned
    263 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by Barnum View Post
    How do I keep the same margin on a page? I am using <body leftmargin="170" rightmargin="170"> and I it's wrong but everything I seem to find does not accomplish what I am after. I have blocks of text in tables and of course text not in tables. The text not in tables is not lining up with the tables and it looks out of whack. I sure hope I am explaining myself okay.

    Is there not one simple code that sets it all the same?
    You can use <body style="margin-left: 170px; margin-right: 170px;">. 170px seems like an awfully big margin, so you'll probably want to reduce that to a smaller number. You can just play about with it until you get the result you want.

    That is fine, if you just want the margins set on a single page, but if you want them set on every page, that's not very efficient, as it means you have to add the style information to the body tag on each page. (And if you decide later on to change the margin width, you'll need to change every page separately.) Much better to put your style information into an external stylesheet and link to it from every page:

    body {margin-left: 25px;
    margin-right: 25px;}

  3. #3
    SitePoint Evangelist Barnum's Avatar
    Join Date
    Oct 2008
    Posts
    418
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sorry to be so late getting back...as usual you answered my question, and I thank you. Was still using the old margin code. Thanks again.

  4. #4
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,163
    Mentioned
    263 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by Barnum View Post
    Sorry to be so late getting back...as usual you answered my question, and I thank you.
    No problem - glad we could help.


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
  •