CSS question

FishBoy

Feeeesh
Joined
1 Aug 2004
Messages
1,685
how do you do import a cascading style sheet into an html code
 
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.
 
Yeah, just insert that into the <head> portion, and it should work.
 
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'>
 
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.
 
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
 
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).
 
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>
 
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.
 
im waitting for my teacher's reply about that too i emailed him to take a look at it, but it's the weekend
 
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
 
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>
 
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. :)
 
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
 
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.
 
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
 
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. :)
 
yea it's pretty weird/anoying and annoying how my page sometimes looks like one thing on firefox and then looks differently on IE
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back