SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding CSS to PHP

    Can you add CSS to PHP code ? I have a bunch of PHP code within one PHP file but I want to stylize them individually, only thing each PHP code has <h1> and <p> tags. I suppose there is no way each <h1> tag can be stylized different if all this can even be done?

  2. #2
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can create a .css file that contains all this <h1> <h2> and other tags you have in your php code and then add it to the php file and it will pull in all the data in the css and style your php code.

    Just add the fallowing line to the top of your php file.


    PHP Code:
    <link type="text/css" href="../stylesheets/whateverfile.css" rel="stylesheet" media="all" /> 
    and it will pull in all the data to the php file you have.

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,194
    Mentioned
    17 Post(s)
    Tagged
    5 Thread(s)
    The only practical way is to use an embedded style sheet or inline styles. Then just output the appropriate style information to the page. I normally use embedded styles in the head rarely inline.

  4. #4
    SitePoint Member
    Join Date
    May 2009
    Location
    philadelphia, pa
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php files are the same as html files, except you can also add php code in places

  5. #5
    Non-Member
    Join Date
    Jan 2008
    Location
    N43 44.4824', W079 13.9408
    Posts
    2,220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, alright it seems simple enough. I will do just that then !


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •