» Site Navigation
2 members and 717 guests
Most users ever online was 47,180, 07-16-2025 at 05:30 PM.
» Today's Birthdays
» Stats
Members: 75,899
Threads: 249,097
Posts: 2,572,069
Top Poster: JLC (31,651)
|
-
Web gurus - HTML/CSS help
I know there are a few members here who got this stuff down, so here goes. I have an image called logobkdg.jpg that I am trying to make a background image for a table, centered X and Y without repeating. If the code will replace the bkgd color I already have the table set at, it's 333333. Thanks in advance.
-
-
Re: Web gurus - HTML/CSS help
off the top of my head....
Code:
.tablebg{
background-image: url(logobkdg.jpg);
background-repeat: no-repeat;
background-attachment:fixed;
background-position:center;
}
<td class="tablebg">
...data...
</td>
I'm looking for other alternatives.
-
-
BPnet Veteran
Re: Web gurus - HTML/CSS help
Code:
<table style="background: #333333 url('logobkdg.jpg') no-repeat center center;">
or
Code:
(in stylesheet)
table.classname {
background: #333333 url('logobkdg.jpg') no-repeat center center;
}
(in code)
<table class="classname">
Of the two, the second is preferred, because the logo url is relative to the stylesheet, so you can have html files in any folder that refer to the class, and the image path will always be derived from the stylesheet path.
The Earth is the cradle of mankind, but one cannot live in the cradle forever. -Konstantin Tsiolkovsky

-
-
Re: Web gurus - HTML/CSS help
ctrlfreq, you need to have "fixed" somewhere in there, otherwise it centers horizontally in FireFox, not vertically.
ctrlfreq's will do the same thing, it all depends on how you have your page set up.
For instance, the way mine is set up, the CSS is either at the top of the web page or in an external CSS file.
ctrlfreq has the style set up inline, which is perfectly acceptable.
can you give us an idea of how your page is set up?
-
-
Re: Web gurus - HTML/CSS help
Thanks guys! I tried the first one and it didn't screw anything up, but the image doesn't appear in the layout. Here is the new code. It's the table within the table I'm working with.
<table width="922" height="458" border="2" cellpadding="4" cellspacing="8">
<tr bgcolor="#000000">
<td width="922" height="700" valign="top"><p><img src="top nav.jpg" width="920" height="139" /></p>
<div align="center">
<table style="background: #333333 url('logobkdg.jpg') no-repeat center center;">
<tr>
<td width="720" height="500" bordercolor="333333" bgcolor="333333"> </td>
</tr>
</table>
</div>
<p> </p></td>
</tr>
</table>
What did I do wrong?
-
-
BPnet Veteran
Re: Web gurus - HTML/CSS help
 Originally Posted by PythonWallace
Thanks guys! I tried the first one and it didn't screw anything up, but the image doesn't appear in the layout. Here is the new code. It's the table within the table I'm working with.
What did I do wrong?
You can't just do what you did in the table, you have to do it in the header. That's not valid HTML code I don't think. I program a lot in php, I use dreamweaver to do all my HTML/CSS b* work.
1.0.0 Normal BP: Vincent Vega
-
-
Re: Web gurus - HTML/CSS help
 Originally Posted by nathanledet
ctrlfreq, you need to have "fixed" somewhere in there, otherwise it centers horizontally in FireFox, not vertically.
ctrlfreq's will do the same thing, it all depends on how you have your page set up.
For instance, the way mine is set up, the CSS is either at the top of the web page or in an external CSS file.
ctrlfreq has the style set up inline, which is perfectly acceptable.
can you give us an idea of how your page is set up?
I'm making an index page, then I plan to edit the contents of this table only and saving them as all the pages of my site. I just started, so here is the entire code. I might be better off making a frameset instead of using the table. I just realized that I don't remember CSS, so I'm trying to stick with simple html. It's been a while I guess.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: 66cc66;
}
body {
background-color: #666666;
}
-->
</style></head>
<body>
<div align="center">
<table width="922" height="458" border="2" cellpadding="4" cellspacing="8">
<tr bgcolor="#000000">
<td width="922" height="700" valign="top"><p><img src="top nav.jpg" width="920" height="139" /></p>
<div align="center">
<table style="background: #333333 url('logobkdg.jpg') no-repeat center center;">
<tr>
<td width="720" height="500" bordercolor="333333" bgcolor="333333"> </td>
</tr>
</table>
</div>
<p> </p></td>
</tr>
</table>
</div>
</body>
</html>
-
-
Re: Web gurus - HTML/CSS help
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: 66cc66;
}
body {
background-color: #666666;
}
.fixedbg{
background-color: #333333;
background-image: url(logobkdg.jpg);
background-position:center;
background-repeat: no-repeat;
background-attachment:fixed;
}
-->
</style></head>
<body>
<div align="center">
<table width="922" height="458" border="2" cellpadding="4" cellspacing="8">
<tr bgcolor="#000000">
<td width="922" height="700" valign="top"><p><img src="top nav.jpg" width="920" height="139" /></p>
<div align="center">
<table class="fixedbg">
<tr>
<td width="720" height="500" bordercolor="333333" bgcolor="333333" class="fixedbg"> </td>
</tr>
</table>
</div>
<p> </p></td>
</tr>
</table>
</div>
</body>
</html>
-
-
Re: Web gurus - HTML/CSS help
something is screwy there..sorry about that...
<table>
<tr class="fixedbg">
<td width="720" height="500" bordercolor="333333" bgcolor="333333" > </td>
</tr>
</table>
Not really sure why you can't put the class to table. It's been so long since i've messed with tables, i've forgotten.
-
-
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|