I have created two divs in a .css file and then I have linked that .css file in a php header file like this
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/headercss.css" type="text/css" media="screen" title="default">
</head>
<body bgcolor="#F0F0F0">
<div class="div_menu">
<h1> asdasd </h1>
</div>
<div class="div_main">
and here’s the css file
@charset "utf-8";
/* CSS Document */
.div_menu{
background-image:url('table_header_options.jpg');
width:70%;
margin:auto;
height:50px;
}
.div_main{
background-color:#FFF;
margin:auto;
width:69.75%;
height:800px;
margin-top:15px;
border-width:1px;
border-style:solid;
border-bottom-color:#ddd;
border-right-color:#ddd;
border-top-color:#aaa;
border-left-color:#aaa;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-moz-box-shadow: 10px 10px 5px #888;
-webkit-box-shadow: 10px 10px 5px #888;
box-shadow: 10px 10px 5px #888;
}
I am sure that there is nothing going wrong with the directories because everythings going fine when I run the php file simply using google chrome but when I try to open it from localhost through wamp server everything disappears except the h1 tag.
Any help will be highly appreciated !
You need to make sure that the css is called from the correct relative postition.
Since this is a PHP header file I assume you’re calling it from various places (like
/,/about,/otherfolder, etc).The problem is that your current code will look for the css folder inside the current folder, not the top folder where it actually is.
Thus:
<link rel="stylesheet" href="/css/headercss.css" type="text/css" media="screen" title="default">Notice the absolute positioning of
/css/headercss.css– the/at the front means “from the top”.EDIT: Turns out OP is using CodeIgniter and should resubmit his question tagged as such.