#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Very simple margin help needed


    Hi,

    I have just started to learn html and css using some tutorials online. I have a tiny bit of css for anchor and headline which works for the color and font family but it will not work for the margin coding I have put in?
    Im sure this is very simple to solve but I cant work out why it will change color and font but not margin, Im sure Ive typed it in correctly.

    Heres the html:

    <!doctype html>

    <html>
    <head>
    <title>Laurence Dorrington</title>
    <link rel="stylesheet" href="css/style.css">
    </head>

    <body>
    <h1>Hello World!</h1>

    <a href="about/about.html"> learn about me </a>

    </body>
    </html>



    and heres the css:

    a {
    color: green; text-decoration: none;
    margin-left: 50px;
    }

    h1 {
    font-family: helvetica, arial, sans-serif;
    margin-left: 50px;
    }


    Any help would be much appreciated, thank you!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    50
    Your code looks okay to me and I tried it on FF20 and IE9 and it worked fine.

    FWIW, when struggling with things like this, I find it helpful to put borders around elements. It helps when visualizing the effect padding and margins are having.

    I would encourage you to put the "a" inside of a group element like a "p" or list element and to use relative units like "em" instead of "px" but neither of those should be resulting in your items not being having the margin you are asking for.

IMN logo majestic logo threadwatch logo seochat tools logo