php - After changing my background-image, my header images are invisible -
i working on webpage. trying make default navigation bar pages, file want include()
navigation bar in:
<html> <head> <title>my webpage</title> </head> <body> <?php include("config/defaults/nav/navigation.php"); ?> </body>
this working fine, how add css? css navigation bar, in location c:/xampp/defaults/nav/styles.css
. in navigation.php
link stylesheet, doesn't work.
edit:
this content of navigation.php, it's navigation bar:
<html> <head> <link href="styles.css" rel="stylesheet" type="text/css"> <script src="nav.js" type="text/javascript"></script> </head> <body> <div class="nav"> <div class="nav_wrapper"> <ul> <li><a href="#">home</li></a> <li><a href="#">mods</li></a> <li><a href="#">search</li></a> <li><a href="#">help</li></a> </ul> </div> </div> </body> </html>
i know basic.
edit 2:
the path navigation.php c:/xampp/htdocs/config/defaults/nav/navigation.php
, htdocs root folder.
there couple of things note here, not need include whole <html>
markup bit in include. confuse web browser , make things go wierd, page gets more complex , if put in correct link path may still not work.
in navigation.php need actual html markup:
<div class="nav"> <div class="nav_wrapper"> <ul> <li><a href="#">home</li></a> <li><a href="#">mods</li></a> <li><a href="#">search</li></a> <li><a href="#">help</li></a> </ul> </div> </div>
also looking @ path navigation style.css
file looks want have different style.css files different parts of page in different directories, highly recommend bringing of styles 1 single file , having main stylesheet i.e. main.css if make maintaining easier, or @ least bringing of stylesheets same directory (and call them main.css, navigation.css example).
that way in main index page have include styles , find easier manage going forward.
to answer main question now, reason style include doesn't work because looking style.css in root of web directory when in reality in folder /defaults/nav/
(assuming c:/xampp website root. changing link include directory structure solve problem:
<link href="/defaults/nav/style.css" rel="stylesheet" type="text/css"/>
the path need point wherever style.css file located, if take advice above different. create css directory in root , put in there path /css/style.css
if have include other css related files can go in there keep things tidy.
best of luck , english pretty good, not 100% perfect understood question easily.
Comments
Post a Comment