Jump to content
xisto Community
Sign in to follow this  
Amezis

Css Body Marins I am probably just stupid...

Recommended Posts

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:

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)

Share this post


Link to post
Share on other sites

I have another question. I am using this code in the HTML:

<td width="120" id=menu"> <a href="http://www.global-rs.com/guides/atlas/;
And this is the CSS:

#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:

<td width="120" class=menu"><a href="http://www.global-rs.com/guides/atlas/;

How can I change the CSS so it will work?

Share this post


Link to post
Share on other sites

<td width="120" id=menu"> <a href="http://www.global-rs.com/guides/atlas/;
And this is the CSS:

.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 *

Share this post


Link to post
Share on other sites

Add to write your CSS more concisely:

.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; }

Share this post


Link to post
Share on other sites

I think I fixed it. But I still don't know what the problem was.

194684[/snapback]


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.

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

Add to write your CSS more concisely:

 

.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; }

194788[/snapback]


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:

| 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.

 


Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I can't help but support Tyssen on this one. Getting something to work is one issue, Standards Compliance is another, and being efficient about both of these is still one more issue to contend with. I still have a lot of learning to do about web site building and CSS and yet I strive to make my code Standards Compliant in an efficient and effective manner. Probably goes back to having a computer where the entire harddrive was 4 Meg and everything had to be done efficiently. But the less volume of code you have to drag around is better for everyone. Your bandwidth at the server and at the clien't side, as well, so lean and mean would be the target for my code.If someone has a better way then I am open to suggestion.

Notice from BuffaloHELP:
Edited as reported.

Share this post


Link to post
Share on other sites

I was pretty sure that my code was standards compliant. I also try to do my best to make things standards compliant. If it is not, please point out where, but I'm pretty sure it is.

Share this post


Link to post
Share on other sites

I was pretty sure that my code was standards compliant.  I also try to do my best to make things standards compliant.  If it is not, please point out where, but I'm pretty sure it is.

 

Nobody said it wasn't. In my first post I said to write your CSS more concisely, i.e. shorter, less file size, better.

jhaslip said:

 

Getting something to work is one issue, Standards Compliance is another, and being efficient about both of these is still one more issue to contend with.

Again, he's referring back to my post about shortening your CSS.

The example you gave, while not incorrect from a standards perspective, is incorrect from an understanding of how CSS works.

Cascading Style Sheets are so called cos the styles cascade down from the top which means that you can set styles on a parent element and all elements contained within will inherit those styles. You only need to specify styles when you want something to be different from its inherited style; you don't need to repeat all the values for each element.

Anchor tags are a common one that newcomers to CSS get wrong: they think they have to specify the text-decoration, font-size, colour etc. for all states when really, in most cases, all those styles can be set on the a tag and only a colour change is needed on the hover, visited etc.

Share this post


Link to post
Share on other sites

I also support Tyssen in this case.

 

Efficiency, and, therefore, standards-compliant code are two highly important aspects of my coding. I am quite detail-oriented, so I am prone to be very precise and accurate in answering a question and help the person understand.

 

I strongly suggest that everyone should help the person who posted the question understand what his/her problem is, so that he/she does not come across the exact same problem again.

 

And, most of all, BE FRIENDLY!! :)

Share this post


Link to post
Share on other sites

Perhaps someone will come along and explain it better, and I wish I could find a version to post here for you.

195409[/snapback]


Okay, it took me a while, but I stumbled upon the answer today, so here it is:

 

Insert this mete tag in the head section of your document.

 

<meta http-equiv= "expires" content = "0" />

This will expire the page in your cache so that the next time you load the page, it looks for the source rather than the version which is in your cache. There is another way to do the same thing by giving the file an expiry date which is already passed. For example using a date of dec 31 2004, the cache expiry date has already passed, so the source will not be cached. I'll post a version here when I find one.

 

When I am building a site, I use this meta tag while editting and reviewing the css files and positioning elements. That way the most recent version is read by the browser. And you don't have to bother emptying the cache before each change is reviewed.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.