Jump to content

External Style sheet will not link? Help please!


Stalingrad

Recommended Posts

Hey! My whole website was deleted at the beginning of the month, so I'm re making the entire site, well.. I'm having a HUGE problem with the CSS. I want the css page to be external. Ih ave a file named style.css here is the EXACT code on the style.css page:

<style>
banner{
font-size: 30px;
font-color: black;
font-family: verdana; }


top{
font-size: 8px;
font-color: red;
font-family: verdana; }


body{
font-size: 14px;
font-color: blue;
font-family: verdana; }
</style>

 

Now.. my website is PHP based, and I'm having trouble getting it to show up. Here is the page I want the css to work on (well, it will be all pages, but I only have index.php up so far). Here is the EXACT code for index.php (with exeption of my database user/password):

<?php
include("style.css");
echo "<banner>Welcome to Hangeia!</banner><br><br><top>Testing this!</top><br><br><body>Testing this again!!</body>";
?>

If anybody can please help me, I would really apreciate it, thanks!!

Link to comment
Share on other sites

here you go.

 

index.php

<html>
<head><title> Hello World </title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>

<?php
echo "<banner>Welcome to Hangeia!</banner><br><br><top>Testing this!</top><br><br><body>Testing this again!!</body>";

?>

</body>
</html>

 

style.css

banner{
font-size: 30px;
font-color: black;
font-family: verdana; }


top{
font-size: 8px;
font-color: red;
font-family: verdana; }


body{
font-size: 14px;
font-color: blue;
font-family: verdana; }

 

Link to comment
Share on other sites

I'm using cpanel to upload my stuff. I do NOT use any program, I create them myself. I'll show you both pages:

style.css:

banner{
font-size: 30px;
font-color: black
;font-family: verdana; }

top{
font-size: 8px;
font-color: red;
font-family: verdana; }

body{
font-size: 14px;
font-color: blue;
font-family: verdana; }

 

and now my index:

index.php:

<html><head><title> Hello World </title>
<link href="style.css" rel="stylesheet" type="text/css"></head><body>
<?php
echo "<td class=\"banner\">Welcome to Hangeia!</banner><br><br><td class=\"top\">Testing this!</top><br><br><td class=\"body\">Testing this again!!</body>";?>
</body></html>

 

othing is working... I had this problem years ago, but I messed around with it and fixed it. I've googled eveyrthing today... nothing is working. thanks!

Link to comment
Share on other sites

your missing some stuff and your adding some unnecessary style too.

 

first things first:

 

assign a type attrribute to your style tags like so:  <style type="text/css">  ...  </style>  in case you use styletags that is

 

Also:

 

If you target a class you assign a dot as a prefix like so: .top    (generic)

If you target an ID you assign a # as a prefix like so #unique (unique element)

 

Besides that have a look at the following (your code adjusted)

body{
font-size: 14px;
color: blue;  // removed the word font-
font-family: verdana;
}
.banner{
font-size: 30px; 
color: black; // removed the word font-
                     // removed the font-family since it already gets it from the body
}
.top{
font-size: 8px;
color: red;  // removed the word font-
                   // removed the font-family since it already gets it from the body
}

 

every time you have troubles with css, go to the w3c validator and run it through: http://jigsaw.w3.org/css-validator

if you have troubles with mark up run it through the other validator: http://validator.w3.org

 

besides that a decent editor is a must

 

happy coding!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.