Announcement

Collapse
No announcement yet.

CSS coding - embedding into html

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CSS coding - embedding into html



    Can someone please help me out. I know there are quite a few of you out there who know a bit of coding, so please help.

    I'm basically having trouble when it comes to CSS and embedding it into the html file.

    I am currently using...

    <style type="text/css" media="all">@import "css/master.css";</style>

    I have not tried this...

    <link rel="stylesheet" type="text/css" href="master.css"/>

    As far as i understand, both are acceptable. For my main page, the html file is able to find the "master.css" file. That is fine. But as soon i make a new page eg www.eric.com/newpage, the directory of "css/master.css" is obvioulsy no longer there - which basically goes the same for all images etc.

    Am i missing something here? there must be another way - apart from adding a "css" and "image" directory to every new page. I thought the point of css was to be able to only edit and load up one page and change the whole site.

    I'm certain im missing something here - and i believe it has something to do with renaming the directory in which the file needs to be found in

    <style type="text/css" media="all">@import "css/master.css";</style>

    so, editing the red bit. im so stressed. someone please clarify.

    self teaching web design is hard!@~

    thanks

    /rant.
    when do we hit v-attack | www.eightsided.com
    sigpic

    #2
    OK this is how I understand it...your CSS file and the main page are in the same directory yeh? I'm gonna assume it's the home directory...

    For example:
    C:\inetpub\WebPage\main.html
    C:\inetpub\WebPage\master.css

    So if your new page is within a new directory, for example:
    C:\inetpub\WebPage\NewDirectory\newpage.html

    then to use the css located in a different directory you just need to add "../" (highlighted in red below) to your CSS reference...

    <link rel="stylesheet" type="text/css" href="../master.css"/>

    ../ = previous directory
    ./ = current directtoy


    Say you have it so the CSS is in it's own directory called css so...

    C:\inetpub\WebPage\css\master.css

    Then you would need to change your CSS reference to the following:
    <link rel="stylesheet" type="text/css" href="../css/master.css"/>
    Team Misplaced CT9A Owner #001

    Comment


      #3
      Give this site a go..
      i use it for all my coding needs =)

      http://www.devguru.com/technologies/css2/home.asp
      Farewell TYP88R

      Comment


        #4
        What Manny said!

        HTML coding is fun...but making it compile with W3C standards sucks!`

        Comment


          #5
          Use parent paths properly.

          <style type="text/css" media="all">@import "/css/master.css";</style>
          I am a lesbian trapped inside a male body

          Comment


            #6
            Originally posted by hebe
            What Manny said!

            HTML coding is fun...but making it compile with W3C standards sucks!`
            most people dont even worry about w3c standards, which is shit. i have problems vieweing UTS websites on firefox sometimes
            T U 8 8 Y R - 0 6 5 4 8

            Comment


              #7
              whats the current tag for the w3c standards? (As in the whole thing from the top of the html page - <!doc.......>

              in trying to make it standard, is it a trial and error issue?

              i'll try and sort out the directory thign and let you know how i go.
              when do we hit v-attack | www.eightsided.com
              sigpic

              Comment


                #8
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                i stole that from the source in this page - thanks!~ lol

                and also i tried the href="../css/master.css" /> and it worked a charm@!~ thanks guys
                when do we hit v-attack | www.eightsided.com
                sigpic

                Comment


                  #9
                  No wukkas mate...happy coding
                  Team Misplaced CT9A Owner #001

                  Comment


                    #10
                    dont code...

                    otherwise your life will be burnt
                    'freakygeek is the stig'

                    Comment


                      #11
                      Too late...he coding already
                      Team Misplaced CT9A Owner #001

                      Comment


                        #12
                        ps - pls dont close this, as i know i will run into more toruble as im learning hehe
                        when do we hit v-attack | www.eightsided.com
                        sigpic

                        Comment


                          #13
                          i would like to confirm i am having more troubles

                          i have now created a new page from the new page
                          so it would look something like www.eric.com/newpage/newpage/index.html

                          and it broke the css/img files, which means it cant find it again.

                          i tried adding an extra "." to the tag

                          href=".../css/master.css">

                          but that did not work lol - it was worth a try. help anyone PLEASE.
                          when do we hit v-attack | www.eightsided.com
                          sigpic

                          Comment


                            #14
                            thanks thanh

                            "../../css/master.css"

                            yay~
                            when do we hit v-attack | www.eightsided.com
                            sigpic

                            Comment


                              #15
                              T U 8 8 Y R - 0 6 5 4 8

                              Comment

                              Working...
                              X