1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Linking to stylesheet using php files

Discussion in 'CSS' started by Colbyt, Apr 30, 2006.

  1. #1
    I am trying to port over a word press stylesheet for use on part of my site.

    The page under discusssion (index.php)will consist of includes from four other pages (header.php, sidelinks.php,main.php, and footer.php). I tried linking to the style.css in the header page between the <style></style> using several variations of:

    I tried this with double quotes and without the /. I also tried absolute reference as in www.mydomain.xxx/dir/style.css.

    Nothing worked until I copied the actual style.css to the space between the <style> </style> section of the header.php file. Then it worked like it should have from the start.

    Did I mess up the syntax?
     
    Colbyt, Apr 30, 2006 IP
  2. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The <link href='style.css' type='text/css' rel='stylesheet' /> goes between the <head></head> tags, but not inside <style></style> tags.
     
    exam, Apr 30, 2006 IP
    kk5st likes this.
  3. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #3
    Do as exam says just put it in thhead not inside the styles tags.

    You can also import them like this though.
    
    <style type="text/css" media="screen">	
    	@import url(scripts/css/shared.css);
    	@import url(scripts/css/special-offers.css);
    </style>
    
    HTML:
     
    johneva, May 1, 2006 IP
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4

    Thanks to all. I will try that this evening.


    I knew it was something silly.
     
    Colbyt, May 1, 2006 IP
  5. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #5
    My understanding was that import was compatible with fewer browsers that the link rel="stylesheet"... syntax.
     
    exam, May 1, 2006 IP
  6. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #6
    I never said it was a better way did I? :rolleyes:

    Infact if you read what I said I recommended what you had already said to do.

    All I said is that it was another way of doing it.
     
    johneva, May 1, 2006 IP
  7. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #7
    And I wasn't criticizing you in any way, :) just making it clear for readers who didn't know.
     
    exam, May 1, 2006 IP
  8. johneva

    johneva Well-Known Member

    Messages:
    1,480
    Likes Received:
    46
    Best Answers:
    1
    Trophy Points:
    170
    #8
    Ah right sorry, me getting girly again. :rolleyes:
     
    johneva, May 2, 2006 IP
    exam likes this.
  9. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #9
    No problem mate :)
     
    exam, May 2, 2006 IP