Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Css Body Marins, I am probably just stupid...
Amezis
post Oct 13 2005, 05:06 PM
Post #1


Privileged Member
*********

Group: Members
Posts: 535
Joined: 14-February 05
From: Oslo, Norway
Member No.: 3,759



Well, I am trying to make my site valid HTML 4.01 Transitional. So, I need to remove the topmargin="0" and leftmargin="0" attributes from the BODY tag. So, I need to do it in CSS. I'm just a rookie CSS, but I think that this code should work:

CODE
body { margin: 0px }


However, that doesn't work for some reason. I've tried the code in a plain document, and it worked there. But why doesn't it work on my site?

My site is http://www.global-rs.com if you want to check out. (I know I have been an idiot using ID instead of CLASS, lots of work to do now)
Go to the top of the page
 
+Quote Post
Amezis
post Oct 13 2005, 05:41 PM
Post #2


Privileged Member
*********

Group: Members
Posts: 535
Joined: 14-February 05
From: Oslo, Norway
Member No.: 3,759



I think I fixed it. But I still don't know what the problem was.
Go to the top of the page
 
+Quote Post
Amezis
post Oct 13 2005, 06:54 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 535
Joined: 14-February 05
From: Oslo, Norway
Member No.: 3,759



I have another question. I am using this code in the HTML:
CODE
<td width="120" id=menu"> <a href="http://www.global-rs.com/atlas/">something</a></td>

And this is the CSS:
CODE
#menu { background-color: #193265; text-align: center; font-weight: bold }
#menu a:link, #menu a:active, #menu a:visited { font-size: 10pt; text-decoration: none; color: #BBC9D7; display: block; width: 100% }
#menu a:hover { background-color: #1F3E7E; color: #BBC9D7; display: block; width: 100% }


However, I want to have class instead of ID in the HTML:
CODE
<td width="120" class=menu"><a href="http://www.global-rs.com/atlas/">something</a></td>


How can I change the CSS so it will work?
Go to the top of the page
 
+Quote Post
reatum
post Oct 13 2005, 08:10 PM
Post #4


Member [Level 1]
****

Group: Members
Posts: 63
Joined: 3-October 05
Member No.: 12,515




CODE
<td width="120" id=menu"> <a href="http://www.global-rs.com/atlas/">something</a></td>

And this is the CSS:
CODE

.menu {
background-color: #193265;
text-align: center;
font-weight: bold
}
.menu a:link, .menu a:active, .menu a:visited {
font-size: 10pt;
text-decoration: none;
color: #BBC9D7;
display: block;
width: 100%
}
.menu a:hover
{ background-color: #1F3E7E;
color: #BBC9D7;
display: block;
width: 100%
}


just chage your (#) to (.)
Go to the top of the page
 
+Quote Post
Tyssen
post Oct 14 2005, 04:27 AM
Post #5



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



Add to write your CSS more concisely:

CODE

.menu {
background-color: #193265;
text-align: center;
font-weight: bold
}
.menu a {
font-size: 10pt;
text-decoration: none;
color: #BBC9D7;
display: block;
width: 100%
}
.menu a:hover { background-color: #1F3E7E; }
Go to the top of the page
 
+Quote Post
jlhaslip
post Oct 16 2005, 01:11 PM
Post #6


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,077
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol



QUOTE(Amezis @ Oct 13 2005, 11:41 AM)
I think I fixed it. But I still don't know what the problem was.
*



Maybe you reset your cache/internet temporary files?
When developing a site and altering things, sometimes your browser picks up info from the local cache rather than the newly editted file, so empty your Internet History or cache frequently to force the browser to review the changes you have made.
There is a Meta tag which 'expires' your page. (sorry that I can't find the exact description on short notice) which is helpful in these situations. It forces the browser to reload a new page every time you request the page and the latest modifications are shown.

Perhaps someone will come along and explain it better, and I wish I could find a version to post here for you.
Go to the top of the page
 
+Quote Post
Lozbo
post Oct 16 2005, 06:07 PM
Post #7


Super Member
*********

Group: Members
Posts: 282
Joined: 1-September 05
From: Wanatos
Member No.: 11,382



I think the second question has been answered, but for the first one:

Try removing the "px" from you rule and add !important to this (some times, some browsers wont apply a rule, but as soon as you add this, its starts working, its like a cheat code to fool browsers or something hehe, Tim Berners Lee received this from the hand of God himself and the w3c got it into their css standars).

So the code you have will be like this:

CSS
CODE

body { margin: 0 !important; }


I also added a semicolon in the end (which is not strictly necesary if you dont have any thing else in the same rule). You never know, all this is not suposed to be necesary but check this out tosee if it worx...

-10730
Go to the top of the page
 
+Quote Post
reatum
post Oct 16 2005, 06:32 PM
Post #8


Member [Level 1]
****

Group: Members
Posts: 63
Joined: 3-October 05
Member No.: 12,515



QUOTE(Tyssen @ Oct 13 2005, 11:27 PM)
Add to write your CSS more concisely:

CODE

.menu {
background-color: #193265;
text-align: center;
font-weight: bold
}
.menu a {
font-size: 10pt;
text-decoration: none;
color: #BBC9D7;
display: block;
width: 100%
}
.menu a:hover { background-color: #1F3E7E; }

*



I notice that you enjoy posting corrections, but not actually helping with problems. There is a forum which discusses this very same phenomenon.
A matter of being polite.

If you don't want to read the whole thing, just read this:
QUOTE(Matt Kruse@java-help.org)
| They're the people who correct an unimportant technical innacuracy in
| someone's story, then wonder why everyone stares at them like they're an
| idiot. They don't quite understand that it's best to just ignore it and
| enjoy the story rather than obsess about technical accuracy.
Go to the top of the page
 
+Quote Post
Tyssen
post Oct 17 2005, 12:59 AM
Post #9



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



QUOTE(reatum @ Oct 17 2005, 04:32 AM)
I notice that you enjoy posting corrections, but not actually helping with problems.

And I notice that you quite often get things wrong which need correcting. In this instance, it wasn't even a correction, merely a suggestion as to how to do things better. And your point might have more validity if we weren't talking about something whose very basis is technical.
I post a lot on other forums where technical preciseness is the norm and not something where it's considered 'unimportant'. So when posting on subjects of this nature, I apply the same level of specificity across all boards.
I can't help it if you don't have the same rigorous standards or the knowledge to match it.