kelli1372
03-11-2007, 03:56 AM
Hello!
I am doing a FAQs page for my web site and I am hoping to make it more colorful since there is a lot of text to go through. I want to add a background image to the page but I want the text to have a white background so the background image doesn't cover the text. In other words, text with a white background over a background image. Can someone give me the HTML code for this or offer help, please?
Thanks!
Hi kelli1372,
There are many ways of achieving what you want. You can use tables or style sheets ( CSS ). Because I do not know anything about the overall layout of your site I have given you the benefit of both worlds.
The following code uses a mixture of both methods.
The CSS <style> section controls the background image and also the characteristics of the text 'box'. The <body> of the code uses a table wrapped around a <div> ( which uses the CSS ), and is where you use a table for youyr text. Like I say, it is using a mixture of both. Just copy this as it is and play around with the values;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Kelli1372</title>
<style type="text/css">
<!--
body
{
background-image : url(YOUR_BACKGROUND_PIC.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
scrollbar-face-color:#cc66ff;
}
.text_box_control
{
position:absolute;
background-color:#ffffff;
top:100px;
left:300px;
border-style: solid;
border-width: 5px 5px 5px 5px;
border-color: #ff0000 #00ff00 #0000ff #000000;
}
-->
</style>
</head>
<body>
<div class="text_box_control">
<table>
<tr>
<td width="400" height="300" align="center" valign="top" bgcolor="#FFFFFF">
<p>
The background is set to background-attachment:fixed
so that it will not scroll.
If you want the background
to scroll set this to background-attachment:scroll.
</p>
<p>
Use TOP and LEFT in the style section to position this box.
</p>
<p>
Use the border-width and border-color in the style section
to set the width and the colors of the
borders.
</p>
<p>
Use the scrollbar-face in the style section to change the
color of the scrollbar.
</p>
</td>
</tr>
</table>
</div>
</body>
</html>
You said you wanted to make it more colorful so I gave you the options to set the individual border colors and widths in;
border-width: 5px 5px 5px 5px;
border-color: #ff0000 #00ff00 #0000ff #000000;
and also the color of the scroll bar at the right of the screen;
scrollbar-face-color:#cc66ff;
The background image can obviously be any format - jpg, png, bmp etc and you can use this for example;
background-image : url(http://www.SOME_WEBSITE.COM/BG_IMAGE.JPG);
I put more help in the text itself for you so you know what's going on.
I hope this helps but if you have any problems then pleas post back.
Regards,
Ges.