How to use margin-left with <hr> and <a>

Discussion in 'HTML' started by Stefan Mueller, Dec 8, 2005.

  1. Because of by background picture I have to use
    <body background = "background.jpg" leftMargin = "0" topMargin = "0"
    marginWidth = "0" marginHeight = "0">

    Therefore I have no margin from the border of the windows. But I'd like to
    have a margin.

    For a normal text I can do
    <div class = "style_text">Bla bla bla</div>

    div.style_text {
    font-family: verdana, tahoma, arial, helvetica, sans-serif;
    font-size: 8pt;
    font-weight: normal;
    color: #cccccc;
    margin-left: 10px;
    margin-right: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    }

    But how can I add a margin to
    <hr color = "#cccccc">

    And how to add a margin to
    <a href = "http://www.server.com" class =
    "style_link">http://www.server.com</a>

    a.style_link {
    font-family: verdana, tahoma, arial, helvetica, sans-serif;
    font-size: 8pt;
    font-weight: normal;
    text-decoration: none;
    color: #cccccc;
    }

    Stefan
     
    Stefan Mueller, Dec 8, 2005
    #1
    1. Advertising

  2. Stefan Mueller

    Steve Pugh Guest

    Stefan Mueller wrote:
    > Because of by background picture I have to use
    > <body background = "background.jpg" leftMargin = "0" topMargin = "0"
    > marginWidth = "0" marginHeight = "0">


    Ooo, how quaint.

    > Therefore I have no margin from the border of the windows. But I'd like to
    > have a margin.


    No, you'd like to have padding.

    body {
    background-image: url(background.jpg);
    margin: 0;
    padding: 1em;
    }

    > For a normal text I can do
    > <div class = "style_text">Bla bla bla</div>
    >
    > div.style_text {
    > font-family: verdana, tahoma, arial, helvetica, sans-serif;


    Google this group's archives for reasons to avoid Verdana.

    > font-size: 8pt;


    Ditto for reasons to avoid tiny, absolutely sized text.

    > font-weight: normal;


    The default, pointless.

    > color: #cccccc;


    Where's the background-color? As you have a background-image on the
    body you should set the background-color and color on that element, not
    just setting a color on child elements. What if you background image
    doesn't load for some reason?

    > margin-left: 10px;
    > margin-right: 10px;
    > margin-top: 10px;
    > margin-bottom: 10px;


    margin: 10px; is more compact.

    > But how can I add a margin to
    > <hr color = "#cccccc">


    Same as any other element.

    But not needed if you set padding on a parent element instead.

    > And how to add a margin to
    > <a href = "http://www.server.com" class =
    > "style_link">http://www.server.com</a>


    Don't. Why aren't your links inside a logical container?

    > a.style_link {
    > font-family: verdana, tahoma, arial, helvetica, sans-serif;
    > font-size: 8pt;
    > font-weight: normal;


    These should all be inherited from the parent element.

    > text-decoration: none;
    > color: #cccccc;
    > }


    Hmm, same colour as the text and not underlined. How is anyone supposed
    to know that these are links?

    Steve
     
    Steve Pugh, Dec 9, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Terry Burns

    Crystal Reports - Left Margin Question

    Terry Burns, Mar 18, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,888
    Terry Burns
    Mar 18, 2006
  2. Peter Charles

    Controlling left margin in a DIV

    Peter Charles, Oct 29, 2003, in forum: HTML
    Replies:
    8
    Views:
    603
    Peter Charles
    Oct 29, 2003
  3. John Seeliger

    left margin different color

    John Seeliger, Apr 24, 2004, in forum: HTML
    Replies:
    5
    Views:
    405
    NewBe
    Apr 25, 2004
  4. Cal Who
    Replies:
    1
    Views:
    432
    Alexey Smirnov
    May 16, 2010
  5. Cal Who
    Replies:
    4
    Views:
    578
    Cal Who
    May 17, 2010
Loading...

Share This Page