Icarus Icarus - 2 years ago 127
CSS Question

Inline css work but external and internal css doesn't work in index.php

As the question suggests I have an index.php file with html in it and when I try to style it using external or internal css, it doesn't work. But inline css works. By the way I am using xampp on win7 to test the website. And the file structure looks like this c:/xampp/htdocs/test/index.php

Relevant html:

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width>

<!--<link rel="stylesheet" type="text/css" href="style.css">-->
<!--This css file contains the css shown below as internal css-->

background-color: blue;
color: white;
color: white;

function somefuntion(){
/*I will be adding this function later once the html skeleton
is done.
This function will be calculating some numbers based on the
current date and echoing it.*/

<section class="header">
<section class="body">
<p>Hello world</p>

Can someone also explain why internal css is not working?

Solution found by hRdCoder: missing " mark in the content attribute of meta tag.

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

Only things to check for are that you add the closing tag and that the style.css file is in the same directory as your index.php.


I just noticed that in your that you're missing the last set of quotation marks (") in the content attribute. Could that be affecting the rest of the page?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download