Posted: Sun Jul 13, 2008 10:02 am Post subject: PHP Coding difficulties
My background is overlapping the rest of my website, and I don't know how to fix that without taking out the background. I need the background to be...well...in the BACKGROUND. Can anyone help me?
Posted: Sun Jul 13, 2008 12:07 pm Post subject: Re: PHP Coding difficulties
This isn't really a PHP issue.
When you set the body background, that influences the entire page. You may want to move that CSS entry to one of your DIVs (if that is how you sectioned your page - I haven't looked) or even down to the <p class=...> level for extra refinement.
Cheers
P.S. I only learn enough CSS to get the task at hand completed - then forget it. But I think that is where your problem stems from.
mario64mario
Posted: Sun Jul 13, 2008 3:22 pm Post subject: Re: PHP Coding difficulties
Well I have two stylesheets: Style.css and Rtl.css. Should I get rid of one?
My Stylesheet stems into nothing but images, and my RTL Stylesheet stems into: header.php, and footer.php.
Updated: I took out 'background-image: url(layout/bgpixel.jpeg);' from the Stylesheet, and the site remains the same.
Aziz
Posted: Sun Jul 13, 2008 3:42 pm Post subject: RE:PHP Coding difficulties
The latest defined rule overwrites the other ones (if they're the same rule, of course)
mario64mario
Posted: Sun Jul 13, 2008 4:58 pm Post subject: Re: PHP Coding difficulties
But it's a matter of bringing the background behind the rest of the content. everything else is there. -.-
rdrake
Posted: Sun Jul 13, 2008 8:52 pm Post subject: RE:PHP Coding difficulties
Moved to web design, not a PHP issue.
DemonWasp
Posted: Mon Jul 14, 2008 9:02 am Post subject: RE:PHP Coding difficulties
Assuming that I understand your problem, the solution is relatively simple. First, remember that all elements will default to having a transparent background, so you will be able to see the body background behind them.
Your HTML page is structured in terms of "containers" - each is inside another one, excepting the body, which is the "root" level container. So, the problem here is that you've got a background specified in the body, but there's nothing drawn over it. To fix this, you need to do something like:
code:
td {
background-color: #fff;
}
And you'd need a different one for each of td, div, and so forth. That will set their background to white, and you'll probably want to change that.
mario64mario
Posted: Mon Jul 14, 2008 9:38 am Post subject: Re: PHP Coding difficulties
So I insert the code you've given me, and replace the colour with the background file I have?
Sponsor Sponsor
jeffgreco13
Posted: Mon Jul 14, 2008 9:57 am Post subject: Re: PHP Coding difficulties
No not at all...
You're background image IS in the background and there is NO WAY that it is overlapping tables on your site. (Unless you screwed up to code, so why dont u post some of it more than just the style)
DemonWasp wrote:
code:
td {
background-color: #fff;
}
And you'd need a different one for each of td, div, and so forth. That will set their background to white, and you'll probably want to change that.
What he means is that would be one of the style attributes. notice the 'td' that means for each table cell it detects it will make the background colour white. if your body { } remains the same then the picture will still be ur background but will have white squares over it where the table cells are.
There seems to be a slight misunderstanding going on here, about how HTML is rendered (and how styles are applied). Forgive me if I go over stuff you already know, I'm just making sure.
HTML has a block structure, meaning that each element has a beginning and an ending. The beginning is in the form <tagName> while the ending is in the form </tagName>; between them is the contents of that block.
Each of these blocks is rendered so that it contains anything that was between the start tag and the end tag.
When elements (such as tables, divs, spans, and so forth) draw, they will only draw parts that have been specified. If they contain text, then they will draw that text; if they have a border specified (as yours do), then they will draw the border. If they do NOT have a background given, then they won't draw a background, and there will instead just be a background showing through them.
This appears to be the problem you're describing: the background shows through the borders / text of your <div> and <table> elements. To prevent that from happening, you can just add the following to the top of your style.css file (warning: will set the background of most/all elements to be white):
This will force those elements to draw a white background over their portion of the body background, so that the body background will NOT show through those elements.
If this is not the problem you're describing, then we will need some example code, or a screenshot - more information to help us understand what's going on.
The three main templates I am assuming are involved in this problem are Header.php, Footer.php, and Index.php. Below, I will post the two style sheets, and the three templates.
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<title>The Legend of Mario
</head>
<table>
<body>
<div id="header">
<img src="http://smb.zeldaoracles.net/layout/banner.png" width="880" height="175">
Footer.php
<hr />
<div id="footer">
<p>
<?php bloginfo('name'); ?> is not in any way affiliated with, connected to, or funded by Nintendo. <br />
Layout Design by Kinopio
</table>
</body>
</html>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
2. Always, always, always indent your code correctly. It may just have been obliterated by posting without the code/syntax tags, but I suspect you don't have any in your actual source. This leads into #3...
3. I may be slightly mistaken because of the PHP stuff (replaced with placeholders, since I don't have LAMP at the moment), but I'm fairly certain you're missing a ton of end-tags. The following is an incomplete listing:
- </title>
- after the Title php code
- </div> corresponding to header <div>
4. You cannot ever have a table wrap around a body tag. Ever. You also seem to have a problem where instead of the following
code:
<Alpha>
<Beta>
</Beta>
</Alpha>
You have:
code:
<Alpha>
<Beta>
</Alpha>
</Beta>
Which is incorrect and shouldn't be rendered correctly (though most modern browsers will correct your mistakes for you.
5. Tables are not for layout, they are for tabular data. You can use them for layout, but technically speaking, it's discouraged. Use <div> elements instead, they're a better plan, and render better cross-browser.
6. Really, you should be forcing the browser to interpret your page as XHTML-strict. Add the following line to the top of your header.php file to tell the browser that you mean XHTML-strict (forces you to write better HTML code, more likely to work with all browsers):
code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
7. Assuming you want to do a really good job, you should then run your code through a validator, to make sure that you're 100% standards-compliant (after that, you can begin the silly-long process of making IE render it acceptably). The accepted standard is W3C, and their validator is here: http://validator.w3.org/
8. As a nitpick, it's generally better form to use names like "footer" or "sidebar" than "center", because changing the appearance of the site later requires changing CSS, not changing the styles referenced. Not critical.
Sorry if that came off as aggressive / mean-spirited. It isn't meant to be; I'm just trying to provide a pointer to being better - take it or leave it as you will. I'll also recognise that I'm certainly not the best webdev out there, by a long shot.
jeffgreco13
Posted: Tue Jul 15, 2008 8:21 am Post subject: Re: PHP Coding difficulties
Yes DemonWasp is exactly right you've got more going on there than just style problems... I'm actually surprised you havent run into further problems. Go through your code and make sure you follow the proper standards.
code:
<html>
</html>
Then
code:
<html>
<body>
</body
</html>
Understand? when you open a tag hit the return button a couple times and end it right away then start coding inside. this almost guarentees that you dont run into the similar problem.
ALSO
Quote:
rtl.css
/*
Theme name: Legend of Mario 1 - The Beginning -
Editors: Mario64Mario; Kinopio
*/
why are u including a php file in a cascading style sheet? makes no sense!!
Also
Header.php reads its styling from style.css yet the <div> in header.php has an id="header" but if you notice in your style.css there is no specific attribute for .header
And the rtl.css isnt being used ANYWHERE in those pages. When you assign an id to a tag I'm almost positive it overwrites default settings.
DemonWasp
Posted: Tue Jul 15, 2008 9:33 am Post subject: RE:PHP Coding difficulties
Ahah, good eyes jeffgreco; I hadn't noticed that he isn't even including rtl.css. I'm not sure what you mean about "When you assign an id to a tag I'm almost positive it overwrites default settings", though. Tags will take all the styles that they match, with the most-specific styles overriding less-specific styles.
For example, if we have:
code:
<div id="myId" class="myClass">Content</div>
Then the following will all apply:
[code]
div { }
.myClass { }
div.myClass { }
#myId { }
div #myId { }
In something like that order (not 100% sure what it is right at the moment). So yes, styles applied based on ID will suppress styles applied based on being a div object, but only if there is some new style to replace them with.
jeffgreco13
Posted: Tue Jul 15, 2008 9:50 am Post subject: Re: PHP Coding difficulties
overwrite might not have been the right word to use....
bar none he's kinda got a CSS nightmare going on there.