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

S

Stefan Mueller

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
 
S

Steve Pugh

Stefan said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top