CSS to center page with no top space

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #16
    torweb and AJM Project,

    When posting code samples you are expected to surround your code with the [code][/code] tags. I have edited your posts to include them. In the future please use the code tags.

    Thank You,

    Kevin

    Comment

    • nostradamuszen
      New Member
      • Sep 2006
      • 1

      #17
      Originally posted by Death Slaught
      lol yes try it like this.

      [CODE=css] * {
      margin:0;
      padding:0;
      }
      . . . . . . . .

      [/CODE]

      Thanks, Death
      Worked a treat for me too Death - FF 3.5, Safari, IE8, Flock.

      When I figure out how to get Trackbacks on Blogger, I'll give you some of those too!

      Comment

      • snmbala
        New Member
        • Apr 2010
        • 1

        #18
        Hey thats so simple

        Set your margin for <body> tag

        body{
        text-align:center;
        margin-top:0px;
        }

        Comment

        • a new eRRoR

          #19
          Thanks Death. Would you mind explaining what the '*' defines though?

          Comment

          • Death Slaught
            Top Contributor
            • Aug 2007
            • 1137

            #20
            Originally posted by a new eRRoR
            Thanks Death. Would you mind explaining what the '*' defines though?
            An asterisk, '*', in CSS is "The Universal Rule". When HTML is rendered in your browser, margin and padding are added to the elements. For example:

            If you have an image on your page.
            Code:
            <img src="iamanimage.gif" alt="I am an image" />
            Even without any stylings added to the page, the placement of the image could differ in Internet Explorer and Firefox. Internet Explorer could basically say,
            Code:
            img {
                    margin: 10px 20px 10px 30px;
                    padding: 0 5px 0 5px;
            }
            and Firefox could say,
            Code:
            img {
                    margin: 20px 10px 20px 10px;
                    padding: 5px 0 5px 0;
            }
            These values are not literal but I'm using them to give you a basic idea of what's going on. These values are added to whatever rules you create in your CSS. Thus the extra or lack of margin and padding across each browser.

            Thanks,
            {\_/}
            (' . ')
            (")[Death](")
            (")(")

            Comment

            Working...