Jul 27, 2008

Css Body Marins - I am probably just stupid...

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > CSS (Cascading Style Sheets)
Pages: 1, 2

free web hosting

Css Body Marins - I am probably just stupid...

Amezis
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)

Reply

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

Reply

Amezis
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?

 

 

 


Reply

reatum

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

Reply

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

Reply

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

Reply

Lozbo
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

Reply

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

Reply

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

Reply

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

Reply

Latest Entries

jlhaslip
QUOTE(jlhaslip @ Oct 16 2005, 07:11 AM)

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




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.

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

Reply

arboc7
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!! biggrin.gif


Reply

Tyssen
QUOTE(reatum @ Oct 19 2005, 02:49 AM)
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:

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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. css body align - 95.65 hr back. (1)
Similar Topics

Keywords : css marins


    Looking for css, body, marins, stupid

Searching Video's for css, body, marins, stupid
advertisement



Css Body Marins - I am probably just stupid...



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE