CSS issue

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

CSS issue

Post by Reason7194 on Fri Jan 14, 2011 1:51 pm
([msg=52162]see CSS issue[/msg])

Hello everyone, i am having a little trouble using css with a included php file. The included file is css for a list of links. What i am trying to do is include my list of link, then use the
Code: Select all
<link rel="stylesheet" href="menu.css">
above it to complete my menu display.

ALSO, my other parts of css that i have in that file are not working.

Does css not work in a php type file? Or am i doing something wrong.

The file i have been talking about:
Code: Select all
<html>
<title>FAQ</title>
<link rel="stylesheet" href="menu.css">
<head>
<center>

<style type="text/css">
body
{
background-image:url('BannerTileBackground.gif');
background-repeat:repeat-x;
width:100%;
height:100%;
}
</style>

<?php include("menuTable.php"); ?>
</center>
</head>
<body>
<center>
<h4>This page is currently under construction</h4>
</center>
</body>
</html>


MenuTable.php file:
Code: Select all
<link rel="stylesheet" href="menu.css">
<div id="nav">
    <ul>

        <li><a href="http://www.justthink.frihost.org/">Home</a>


        <li><a href="http://www.justthink.frihost.org/FAQ.php/">FAQ</a>

           




        <li><a href="#">Contact us</a>
       

        <li><a href="#">Websites</a>
               

    </ul>

</div>
I study Gotafu.
Reason7194
Poster
Poster
 
Posts: 215
Joined: Fri Jan 07, 2011 5:01 pm
Blog: View Blog (0)


Re: CSS issue

Post by tremor77 on Fri Jan 14, 2011 2:43 pm
([msg=52167]see Re: CSS issue[/msg])

First in your main file.. lets call it index.php you have a bunch of generic mistakes....

Code: Select all
    <html>
<!-- head tag always 2nd this was out of place -->
    <head> 
    <title>FAQ</title>
    <link rel="stylesheet" href="menu.css">
<!-- you need to close the head tag before continuing with any HTML -->
     </head>


that's for starters... you should look up the basic structure of an HTML file.. is no different in PHP. Continuing more issues in your index.php

In the body, just leave it be.. set your style in a stylesheet .css file for body and call it above in the head, before menu.css

Code: Select all
<body>
    <center>
    <?php include("menuTable.php"); ?>
    </center>
</body>
</html>


In your menutable.php file, don't call the menu stylesheet a 2nd time it does no good.. clean that up and re-post your progress .. i'll make sure to check back.
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: CSS issue

Post by Reason7194 on Fri Jan 14, 2011 5:39 pm
([msg=52181]see Re: CSS issue[/msg])

Sadly i have not had any positive progress. I did however fix the little snags in my code to make it look neater and easier to understand.

My "menu.css" file is the file that is the stylesheet for my "menuTable.php" file.

menuTable.php = list of links

menu.css = stylesheet

I am confused on when you said
In the body, just leave it be.. set your style in a stylesheet .css file for body and call it above in the head, before menu.css


When you said, "In the body, just leave it be..", what are you referring to when you said "it"?

When you said "set your style in a stylesheet .css file for body and call it above in the head, before menu.css", i think you mean by style, my back ground and other css syntax.

I saved that css syntax and called it in with a
Code: Select all
<link rel="stylesheet" href="style.css">
before the link of "menu.css"

I took off the 2cd menu stylesheet as you said.

Here is FAQ.php:
Code: Select all
<html>


<head>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="menu.css">

<style type="text/css">
body
{
background-image:url('BannerTileBackground.gif');
background-repeat:repeat-x;
width:100%;
height:100%;
}
</style>
</head>
<title>FAQ</title>

</head>

<body>
<center>
<?php include("menuTable.php"); ?>
<h4>This page is currently under construction</h4>
</center>
</body>

</html>


Here is menu.css:
Code: Select all
*{ margin:0px; padding: 0px; }

#nav {
font-family: arial, sans-serif;
position: relative;
width: 550px;
height:56px;
font-size:20px;
color:#999;
margin: 0 auto;
}

#nav ul {
list-style-type: none;
}

#nav ul li {
float: left;
position: relative;
}

#nav ul li a {
text-align: center;
border-right:1px solid #e9e9e9;
padding:20px;
display:block;
text-decoration:none;
color:#999;
}

#nav ul li ul {
display: none;
}


Here is style.css:
Code: Select all
<style type="text/css">
body
{
background-image:url('BannerTileBackground.gif');
background-repeat:repeat-x;
width:100%;
height:100%;
}
</style>


I hope i didnt post what was unneeded, but i had to be safe.

Could someone explain what i am doing wrong or what logic or syntax i am missing?

Thank you
I study Gotafu.
Reason7194
Poster
Poster
 
Posts: 215
Joined: Fri Jan 07, 2011 5:01 pm
Blog: View Blog (0)


Re: CSS issue

Post by dellex on Fri Jan 14, 2011 8:06 pm
([msg=52188]see Re: CSS issue[/msg])

You put "</head>" twice in your main file. Remove the first one.

The include command takes place inside the body section. The '<link rel="stylesheet" href="menu.css">' must be placed in the header section.


And some suggestions:
1. Since you put your styles in an external css file (style.css), there's no need to have them in your main file.
2. Remove the <style> tags from style.css.
3. Don't use <center> tags. Use css instead.
4. Put a type attribute in your css links and close the tag: <link rel="stylesheet" href="menu.css" type="text/css" />
User avatar
dellex
New User
New User
 
Posts: 34
Joined: Tue Jun 01, 2010 7:36 am
Blog: View Blog (0)


Re: CSS issue

Post by Reason7194 on Sun Jan 16, 2011 2:30 am
([msg=52233]see Re: CSS issue[/msg])

Alright, well i did what you said to do, but i was only able to make it work on the home page.

I have been messing around trying to figure out why it wont work and i have found a few things.

1.) I have noticed that on the homepage, when your pull up the source code and click on the menu.css or style.css...it will bring you to the indicated css file like it should. However, when someone trys the samething on the FAQ page, it wont bring up anything. Why wont the FAQ.php file read css code? I dont understand why it wont work on the FAQ.php page =/

Advice and help?
I study Gotafu.
Reason7194
Poster
Poster
 
Posts: 215
Joined: Fri Jan 07, 2011 5:01 pm
Blog: View Blog (0)


Re: CSS issue

Post by thetan on Mon Jan 17, 2011 1:51 pm
([msg=52311]see Re: CSS issue[/msg])

and the contents of menuTables.php are?
"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

Image

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein
User avatar
thetan
Contributor
Contributor
 
Posts: 657
Joined: Thu Dec 17, 2009 6:58 pm
Location: Various Bay Area Cities, California
Blog: View Blog (0)


Re: CSS issue

Post by Reason7194 on Mon Jan 17, 2011 2:41 pm
([msg=52315]see Re: CSS issue[/msg])

Code: Select all
<div id="nav">
    <ul>

        <li><a href="http://www.justthink.frihost.org/">Home</a>


        <li><a href="http://www.justthink.frihost.org/FAQ.php/">FAQ</a>

           




        <li><a href="#">Contact us</a>
       

        <li><a href="#">Supported</a>
               

    </ul>

</div>


MenuTable.php ^
I study Gotafu.
Reason7194
Poster
Poster
 
Posts: 215
Joined: Fri Jan 07, 2011 5:01 pm
Blog: View Blog (0)


Re: CSS issue

Post by tremor77 on Wed Jan 19, 2011 12:47 pm
([msg=52433]see Re: CSS issue[/msg])

Why dont you consider putting everything into 1 file called mypage.php.. the whole works!!! the styles, the code and the HTML.. all in one document.. this way you can get yourself a working template in a more organized fashion to start off with, and it can help us troubleshoot your code more readily. Then, when the time is right and you are ready to expand your template, you can break out the areas the can be linked by includes and stylesheets. There are still several grievous errors and formatting issues within your code. Putting it all into one file and going over it a bit more thoroughly line by line might help you locate your issues.
User avatar
tremor77
Addict
Addict
 
Posts: 1098
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: CSS issue

Post by Reason7194 on Thu Jan 20, 2011 2:02 pm
([msg=52521]see Re: CSS issue[/msg])

Alright, i'm that you have taken your time to reply to this. Your advice really helps.

I will update soon with a full working page that has everything working.
I study Gotafu.
Reason7194
Poster
Poster
 
Posts: 215
Joined: Fri Jan 07, 2011 5:01 pm
Blog: View Blog (0)


Re: CSS issue

Post by kujinR on Fri Jan 21, 2011 8:16 am
([msg=52574]see Re: CSS issue[/msg])

Hmm..I seem to remember you posting a link to your site. But, it's not here anymore. Anyway, I checked the site(back when I had the link) and remember thinking about how weird your faq link was. I can't be sure now coz I can't see it anymore, but I also remember that the FAQ link was in fact a link to a folder, not a file. That may be what's causing the problem.

Weird, how I remember all these things. Meh.
"Better to keep your mouth shut and be thought a fool than to open it and remove all doubt."
"red = changed"
User avatar
kujinR
Poster
Poster
 
Posts: 273
Joined: Thu Jul 29, 2010 4:39 am
Blog: View Blog (0)


Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests