Log in

View Full Version : W3C Compliant



Uchiha_Guy
06-17-2007, 03:55 PM
I'm trying to make my site W3C Compliant to the webs standards, but it seems the <br /> tags are not recognized, is there anything else I can use to space and separate Div's?

mwinter
06-17-2007, 04:27 PM
I'm trying to make my site W3C Compliant to the webs standards, but it seems the <br /> tags are not recognized,

Without seeing the mark-up in question, I can't be certain, but I expect that you are using the br element in a location where it is not permitted.

The following will probably sound elitist, but I write it so that you don't encounter problems in the future. If you fall foul of a relatively simple error such as the one described above, you probably don't understand XML or XHTML properly. As such, I would advise that you stay away from both: use HTML, only. Serving XHTML on the Web is dubious at the best of times and has several considerations, especially for the future, that require a good depth of knowledge.



is there anything else I can use to space and separate Div's?

You wrote of conformance earlier; even if you did use br elements to visually separate div elements, you would not be conforming to W3C Recommendations. (Note that there's a difference between validity and conformance.)

The br element is meant to break a line, not introduce vertical space. For example, each line of a verse or an address needs to be broken from the lines before it, so using the element is fine. If you need to add space between two elements, use CSS - Cascading Style Sheets. Add margins or padding, typically using the em unit amongst text, to the element you want to separate.

Hope that helps.

Uchiha_Guy
06-17-2007, 05:31 PM
Yes, I myself am a new coder, I hand coded my site through notepad and uploaded it to my FTP on my host, then I rigorously edited the code to work properly in both Fire Fox and IE, then I started validating my document which took awhile and all I have left is the <br /> tag, I'm not sure how to separate the Div's using CSS, everything I've tried didn't work.

mwinter
06-17-2007, 05:36 PM
No problem. Could you please post a link to the document in question. CSS selectors - the notation one uses to choose elements to style - depends on structure so it's not so easy just to post a solution without knowing what you've created, and how.

Uchiha_Guy
06-17-2007, 11:51 PM
My host is down right now, so I have to wait til they have everything back up and running so I can get the source. I was stupid not to download all my files into a folder on my desktop incase something like this happened lol.

alexjewell
06-18-2007, 12:02 AM
Ha, I suggest making the files on your computer first, then uploading it to your host.

Uchiha_Guy
06-18-2007, 12:16 AM
Ha, I suggest making the files on your computer first, then uploading it to your host.

I hand code all my stuff in notepad and upload them in the FTP. The thing is, I started editing my files in my FTP instead of what was saved on my computer then reuploading them lol.

alexjewell
06-18-2007, 12:49 AM
Haha, bad habit.

Uchiha_Guy
06-18-2007, 01:59 AM
Haha, bad habit.

Its really going to suck if they can't recover my files :-(...god the horror of revalidating the CSS and HTML lol.

alexjewell
06-18-2007, 02:06 AM
hahaha. it was difficult in the beginning, but it's worth it in the end.

Uchiha_Guy
06-18-2007, 03:11 AM
I feel more satisfied and accomplished when my sites are validated.

alexjewell
06-18-2007, 02:36 PM
Yeah, there's that too. Plus, it's more organized and easier to edit, etc.

Uchiha_Guy
06-19-2007, 02:04 AM
My host still isn't up >_<. I'm going to be really sad if I lose my files. Once I get them back I can show my code and hopefully get help why my <br /> tag isn't being validated.

alexjewell
06-19-2007, 02:08 AM
Ha, good luck. When you get it back up, let me know...I'll help.

boogyman
06-19-2007, 12:28 PM
you do not need <br /> to separate your div's there is a css property called margin's which will accomplish what you want. also if you are looking to make some other tag that doesn't have a default "clear" after it (eg it can be written inline) such as span, you can use the css property display:block;.

and yes it really is a major crimp when you lose your host. but think of it this way, at least you are learning early on not to trust a host explicitly... its a lot better than losing a 50page 1mill entry database driven site, which sadly I had happen to me. I had a backup plan, the only problem was it was through the host, and their data-center went up in flames, so yah it was a lost cause

Uchiha_Guy
06-20-2007, 12:05 AM
You have to forgive me, I'm not familiar with using margins in the CSS. This is the old CSS I used before I updated it in my FTP.




#header {
background-image: url(Images/header.png);
border: 1px dashed #bbbbbb;
height: 150px;
width: 700px;
}

#navbar {
background: #f0f0f0;
border: 1px dashed #bbbbbb;
width: 690px;
padding-top: 10px;
padding-right: 0px;
padding-bottom: 10px;
padding-left: 10px
}

#contentarea {
background-image: url(Images/shield_background.png);
background-color: #f0f0f0;
background-position: center;
background-repeat: no-repeat;
border: 1px dashed #bbbbbb;
height: 500px;
width: 680px;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px
}

#footer {
background: #f0f0f0;
border: 1px dashed #bbbbbb;
width: 690px;
padding-top: 10px;
padding-right: 0px;
padding-bottom: 10px;
padding-left: 10px
}



How do I use margins to space the Div's?

Here is an example of how I have them spaced.




<div id="header"></div>

<br />

<div id="navbar"></div>

Uchiha_Guy
06-20-2007, 11:57 PM
Bump. Help?

tech_support
06-21-2007, 06:56 AM
#header {
background-image: url(Images/header.png);
border: 1px dashed #bbbbbb;
height: 150px;
width: 700px;
padding-bottom:20px;
}

boogyman
06-21-2007, 01:41 PM
<div id="header"></div>

<br />

<div id="navbar"></div>




<style type="text/css">
div#navbar {
margin-top: 1em;
}
</style>

Uchiha_Guy
06-21-2007, 02:29 PM
#header {
background-image: url(Images/header.png);
border: 1px dashed #bbbbbb;
height: 150px;
width: 700px;
padding-bottom:20px;
}

Thanks, that did the job hahaha.