• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

CSS question

Grandmaster

Electronica Addict
Political User
#2
You're trying to use a CSS for your site right? I think that's what the question is. To do so, simple insert the following into the <head> portion of your html:

Code:
<link rel="stylesheet" type="text/css" href="mystyle.css" />
That should work.
 
#5
and what does all this mean??.. sorry im learning html im still new to it.. i know i should've learned it long time ago but oh well...

Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN'
                      'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
 

Grandmaster

Electronica Addict
Political User
#6
http://www.w3schools.com/

Start there, and read up on XHTML and CSS. It's where I learned both from, and that site is an extremely useful resource, and quite easy to understand.

After that, you'll need to practice a bit, and after the first site it becomes quite easy :)

edit: can we get a link to your site? It will makes things easier to explain.
 
#7
well actually it's one of my courses in college but it's the last class of the day starting at 3 20 and ending at 5 so i dont usually pay attention in that class i just look at the prof's enthusiast in the internet
 
#8
FishBoy said:
and what does all this mean??.. sorry im learning html im still new to it.. i know i should've learned it long time ago but oh well...

Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN'
                      'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
The first row denotes the XML version and the character encoding for the parser (in this case the web browser) to use.
The second line is the document type, in this case XHTML 1.0 Framset.
The last row is the pointer to which XML namespace is being used, i.e. which tags are valid in the document (in this case XHTML).
 
#10
why isn't that html code validatting?

Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN'
                      'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
 <head>
  <title>Menu</title>
  <link rel="stylesheet" type="text/css" href="../css/mycss.css" />
 </head>
 <body>
  <table border='1' cellspacing='3' cellpadding='0' align='center'>
   <tr><td>Home</td></tr>
   <tr><td><a href="../products.html" target='MainFrame'>Products</a></td></tr>
   <tr><td><a href="../contact.html" target='MainFrame'>Contact</a></td></tr>
   <tr><td><a href="../links.html" target='MainFrame'>Links</a></td></tr>
   <tr><td><a href="../feedback/index.html" target='MainFrame'>Feedback</a></td></tr>
   <tr><td><a href="../honesty.html" target='MainFrame'>I Declare</a></td></tr>
   <tr><td><a href="../css/mycss.css" target='_blank'>My CSS</a></td></tr>
   <tr><td><a href="http://alexis/~i2222d29/index.html" target='_blank'>Alexis</a></td></tr>
  </table>
 </body>
</html>
these are the errors from the validator

Line 9, column 6: document type does not allow element "body" here

<body>

Line 21, column 6: end tag for "html" which is not finished

</html>
 
#11
Hmm, good question.

This should validate (new document in Dreamweaver).
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>

</body>
</html>
The only big difference I can see is the content-type tag. But it shouldn't be that vital.
 

melon

MS-DOS 2.0
Political User
#13
FishBoy said:
why isn't that html code validatting?

Code:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN'
                      'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
 <head>
  <title>Menu</title>
  <link rel="stylesheet" type="text/css" href="../css/mycss.css" />
 </head>
 <body>
  <table border='1' cellspacing='3' cellpadding='0' align='center'>
   <tr><td>Home</td></tr>
   <tr><td><a href="../products.html" target='MainFrame'>Products</a></td></tr>
   <tr><td><a href="../contact.html" target='MainFrame'>Contact</a></td></tr>
   <tr><td><a href="../links.html" target='MainFrame'>Links</a></td></tr>
   <tr><td><a href="../feedback/index.html" target='MainFrame'>Feedback</a></td></tr>
   <tr><td><a href="../honesty.html" target='MainFrame'>I Declare</a></td></tr>
   <tr><td><a href="../css/mycss.css" target='_blank'>My CSS</a></td></tr>
   <tr><td><a href="http://alexis/~i2222d29/index.html" target='_blank'>Alexis</a></td></tr>
  </table>
 </body>
</html>
these are the errors from the validator
Is XHTML 1.0 Frameset what you want to use? I admit I don't know much about what project you're doing, but try changing the DOCTYPE to XHTML 1.0 Transitional or XHTML 1.0 Strict. That may be why it's not validating correctly.

I'm too lazy to copy the code to a file and revalidate it myself. :p

Melon
 
#14
Change all your single quotes to double quotes. XHTML does not allow single quotes as far as I can remember.

Also put your body content into a <noframes> tag if your using a frameset.

To import a stylesheet instead of just linking a stylesheet, use the following in the head section of your page:

<style type="text/css" media="screen">
@import "mystylesheet.css";
</style>
 
#15
melon said:
Is XHTML 1.0 Frameset what you want to use? I admit I don't know much about what project you're doing, but try changing the DOCTYPE to XHTML 1.0 Transitional or XHTML 1.0 Strict. That may be why it's not validating correctly.
Oh right, that's probably it, yes. :D Never used XHTML 1.0 Frameset. :)
 
#16
well it turns out i only had to use frames for another page for the first pages i can just make them normal, but i might use that knowledge for when i get to do the frames pages
 
#17
just a note, for actual CSS rendering

MSIE has two "box models" which is uses to figure out how to divide up a page with CSS. If the first line of the page is <!DOCTYPE html PUBLIC ...... then it will use the more compliant box model. So if you are being completely and properly XHTML compliant you will have <?xml version="1.0" ....... and MSIE will use its "Quirky" box model and your CSS can end up rendering incorrectly. For this reason it is often easier (CSS wise) to leave off the <?xml .... line slightly breaking your compliance, though no validator will truely fault you for this, in order to improve page rendering. Just thought I would mention this if you were having any problems with the way in which your CSS was being applied to your page in MSIE. Hopefully MSIE7 will fix this and we can all go back to writing properly compliant websites again.
 
#18
is there a way like if i click on a link it opens a new page but keeps the url as the same? in html only no java script or stuff like that, coz my project has to be html only

ecdit: and no framesets either
 
#19
Geffy said:
just a note, for actual CSS rendering

MSIE has two "box models" which is uses to figure out how to divide up a page with CSS. If the first line of the page is <!DOCTYPE html PUBLIC ...... then it will use the more compliant box model. So if you are being completely and properly XHTML compliant you will have <?xml version="1.0" ....... and MSIE will use its "Quirky" box model and your CSS can end up rendering incorrectly. For this reason it is often easier (CSS wise) to leave off the <?xml .... line slightly breaking your compliance, though no validator will truely fault you for this, in order to improve page rendering. Just thought I would mention this if you were having any problems with the way in which your CSS was being applied to your page in MSIE. Hopefully MSIE7 will fix this and we can all go back to writing properly compliant websites again.
Oh, I didn't know that. That's good to know, thanks Geffy. :)
 

Members online

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,013
Latest member
Pdawgintown