Style PHP

Discussion in 'HTML & Website Design' started by forumSEO, Apr 9, 2007.

Thread Status:
Not open for further replies.
  1. #1
    how do you make a style file, please tell me the basics and what are the advantages and disadvantages or having one.

    Thankyou
     
    forumSEO, Apr 9, 2007 IP
  2. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2

    you mean create a file with css and use the include function with php so you dont have to copy paste the css in each page?
     
    Dirty-Rockstar, Apr 9, 2007 IP
  3. forumSEO

    forumSEO Guest

    Messages:
    681
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yeah, I think that is want I want. I have a few templates and they act weird when I do not upload the style thing. What are the pros and cons of using them?
     
    forumSEO, Apr 10, 2007 IP
  4. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Style sheets even if they are placed in the source code, greatly improve the speed of the loading time since it shorten its size. With an external css a usual filesize can be reduced with almost 50%.
     
    Bagi Zoltán, Apr 10, 2007 IP
  5. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    pros

    its easy
    if every layout on a page is the same it saves in editing
    did i mention its easy?

    make a file called css.php and put whatever your heart desires in it. then on the pages you want it to show up on put this on the top of the page

    
    
    <?php
    include 'css.php';
    ?>
    PHP:
    below that you dont need to bother putting in the css because its pulled from the .php file. im assuming your keeping both files in the same directiory if not you need to change whats in the php statement to the directory the css.php file is in

    hope i clarified. im a noob myself
     
    Dirty-Rockstar, Apr 10, 2007 IP
  6. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hrmm, maybe im talking about something else. ill shut up now :S
     
    Dirty-Rockstar, Apr 10, 2007 IP
  7. forumSEO

    forumSEO Guest

    Messages:
    681
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I just read about it on a different site. It is style.css not style.php. Can you explain how to make a style.css.
     
    forumSEO, Apr 10, 2007 IP
  8. Rasczak

    Rasczak Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hey,

    just try a simple "hello world" HTML page:

    <html>
    <head>
    <title>hello world</title>
    </head>
    <body>
    <h1>Hello World!</h1>
    </body>
    </html>


    ... and display it in the browser. Good. Now add this to the HEAD section (after TITLE maybe):

    <style type="text/css">
    body {background:silver; color:navy}
    </style>


    Save, reload. Do you see the difference? Now try more (into STYLE section):

    h1 {font-size:40pt; text-decoration:underline; color:#440000}

    and so on - no fear, just keep experimenting :)
    Then, you can save everything whats between STYLE tags into a file (let's say style.css).

    There won't be a STYLE in the HTML's HEAD section then - you just include the external stylesheet with this LINK tag:

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

    So much for the magic ;-)

    Good luck!
     
    Rasczak, Apr 10, 2007 IP
  9. forumSEO

    forumSEO Guest

    Messages:
    681
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thankyou for helping. I will go through your example. I am new to this so please be patient. I am having troubles:

    Ok, done

    please explain more carefully. Is there two seperate files?

    Is there two seperate files? or do I add that code into the hello world document.
     
    forumSEO, Apr 10, 2007 IP
  10. Rasczak

    Rasczak Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yes, in this moment you are still working/experimenting with one HTML file, with no external CSS file.
    When you want the CSS definitions "outside" the HTML, then you copy&paste it into a new file, saving it as style.css and LINKing it from the HTML file, like I specified above...
     
    Rasczak, Apr 10, 2007 IP
Thread Status:
Not open for further replies.