CSS question

Discussion in 'Web Design & Coding' started by FishBoy, Mar 12, 2005.

  1. how do you do import a cascading style sheet into an html code
     
  2. Grandmaster

    Grandmaster Electronica Addict Political User Folding Team

    Messages:
    10,574
    Location:
    Santa Clara, CA
    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.
     
  3. and that'll do all the work automatically right?
     
  4. Grandmaster

    Grandmaster Electronica Addict Political User Folding Team

    Messages:
    10,574
    Location:
    Santa Clara, CA
    Yeah, just insert that into the <head> portion, and it 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'>
    
     
  6. Grandmaster

    Grandmaster Electronica Addict Political User Folding Team

    Messages:
    10,574
    Location:
    Santa Clara, CA
    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.
     
    FishBoy likes this.
  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. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    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).
     
    FishBoy and NetRyder like this.
  9. oh cool thx zedric and grandmaster :D
     
  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

     
  11. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    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.
     
  12. im waitting for my teacher's reply about that too i emailed him to take a look at it, but it's the weekend
     
  13. melon

    melon MS-DOS 2.0 Political User

    Messages:
    854
    Location:
    Ásgarðr
    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. RickyC

    RickyC OSNN Addict

    Messages:
    199
    Location:
    Earth
    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. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    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. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    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.
     
    Zedric likes this.
  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. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Oh, I didn't know that. That's good to know, thanks Geffy. :)
     
  20. yea it's pretty weird/anoying and annoying how my page sometimes looks like one thing on firefox and then looks differently on IE