473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Help With CSS Backgrounds

First I have to tell you guys how much of a help you are to a kid my age. People literally gave me the code to solve my problem last time.

Here is my problem.

I am trying to get into the habit of using CSS with HTML (soon to be XHTML) and it is going pretty well. I am creating the shadow effect with a page so it looks like the content is floating on a plate, you have probably seen this all over the web. So I have a 800 pixel wide by 10 pixel tall image that is white with a gradient/shadow on both edges and a green bar to make a secondary content area on the right of the page. Here is the image.
Here

There is another image that should make a white bar across the top of the page that will eventualy hold a title. That image is here
(Please Ignore the text!)

Actually Here Is My Problem

The First image is repeating itself down the page nicely. But the second image does not display at the top correctly, well sorta. Let me explain. Here is my Css code.
Expand|Select|Wrap|Line Numbers
  1. body {
  2.     background-image: url(../cssTesting/Images/wrapperGIF.gif);
  3.     background-repeat: repeat-y;
  4.     background-position: center center;
  5.     text-align: center;
  6. }
  7. #titleLayer    {
  8.     background-image: url(Images/wrapperTitleGIF.gif);
  9.     background-repeat: no-repeat;
  10.     background-position: center top;
  11.     background-attachment: fixed;
  12.     height: 70px;
  13.     width: 800px;
  14.     float: none;
  15. }
Body Displays the shadowed image wrapperGIF.gif down the whole page and the class title layer is suposed to make the title image appear corectly. It does not. Click here to see what I mean. It does not display corectly in IE, Firefox, Netscape or Opera (Don't know about safari, wish I did though (:) Want a Mac!))

Here is my HTML
[HTML]<html>
<link rel = "stylesheet" type = "text/css" href = "test.css">
<div class="titleLayer" id="titleLayer"></div>
<body>
</body>
</html>[/HTML]

The title kinda stops. But here is the wierd thing, when I put a space in between the 800 and px in my CSS it displays corectly. In IE, and Firefox but still not Opera or Netscape, but it probably renders in Safari IDK? I am just puzzeled why the space would do that. Here is another thing, when I put a space after the 70 it makes the layer really small, height wise?


Also if it helps any the images are
wrapperGIF (800, 10)
wrapperTitleGIF(800, 70)

Thanks,
Matt
May 28 '07 #1
16 1774
drhowarddrfine
7,435 Expert 4TB
First I have to tell you guys how much of a help you are to a kid my age.
You write more coherently than half the people that post on technical forums.

I am trying to get into the habit of using CSS with HTML (soon to be XHTML)
I would not concern myself with XHTML. IE doesn't recognize it and chances are you aren't serving it as such.

I'm doing a major upgrade to my dev computer, coming up on 24 hours of updates, so don't know when I'll be able to look at this.
May 28 '07 #2
You write more coherently than half the people that post on technical forums.
Thanks!, I don't think so though. There are some pretty smart people here.

See Ya,
Matt
May 28 '07 #3
Hey this is just a simple update. I have duplicated the css and html files 2 times and put them on the server for 2 reasons. One is that one has the space and another has no space inbetween the 800 and px. The other is so I can edit the original to see if I can find the awnser myself.

Click here for the one with the spaces
And here for the one without them.

Thanks,
Matt (The throughly stumped one)
May 29 '07 #4
drhowarddrfine
7,435 Expert 4TB
No, you can't have a space between 800 and px.

You need a doctype at the head of your page to keep browsers on the same set of rules. See the article at the top in the html/css section about doctypes. Also, read the part about validating.

I totally botched my dev computer and need to reinstall everything.
May 29 '07 #5
I added a Doctype, unfortunately it did nothing. I then validated it and it gave me a few errors. Please go valididate it with the W3C so I don't clutter copy and pasting it here. I only get a couple of errors. Some I don't understand why it is complaining about a head tag. My CSS is fine I even validated it. It is still having this wierd quirck where the img will go away after so many pixels, with or without the body background.

Thanks,
Matt
May 29 '07 #6
drhowarddrfine
7,435 Expert 4TB
It complains about <head> because <title> is required.
You are missing some "traditional" markup, such as <body>, <head>. Many may be surprised to know these are optional elements.

You need a doctype no matter what. Browsers go into quirks mode and everything will be all screwed up.

The error needs to be fixed in the css, too.

Please explain about the space a little more. I see a problem but I don't know if we're talking about the same thing.

Again, my dev computer is totally down and probably will be all day.
May 29 '07 #7
Ok, I got it down to one error now. It tells me character data is not allowed in my link tag to associate the style sheet with the document. ???? Also I posted a screen shot of what I want it to look like. Click here to see it. The top is what the page looks like when there is no space in between the 800 and px, this is what I don't understand, when I put a space there I get the bottom. In The top screen shot the title img is definatley not 800 pixels wide because the background in 800 px wide??? Click on the links above for the ones with and without that space. Do you see what I am saying? I have tried but I still cannot get It to work.

Thanks,
Matt
May 29 '07 #8
Thanks for your guidence, I really only turn to here if I need to. I usualy try to figure it out myself. You should see how many books I have on programing almost 20 or 30. I don't know why just setting the width of the layer did not work. So I changed it to auto and I worked, in all the browsers (IE, FF, Netscape, Opera) could somebody please who is blessed enough to have a mac check it in safari for me. Here is my css code

Expand|Select|Wrap|Line Numbers
  1. body {
  2.     background-image: url(../cssTesting/Images/wrapperGIF.gif);
  3.     background-repeat: repeat-y;
  4.     background-position: center center;
  5.     text-align: center;
  6. }
  7. #titleLayer    {
  8.     background-image: url(Images/expermentGIF.gif);
  9.     background-repeat: no-repeat;
  10.     background-position: top center;
  11.     background-attachment: fixed;
  12.     height: 70px;
  13.     width: auto;
  14. }
Thanks,
Matt

P.S. Could you please explain to me why setting the width of the layer did not work though...
May 29 '07 #9
drhowarddrfine
7,435 Expert 4TB
Is the page online? You said you are down to one error but I see four on one previous link and five on the other.
May 29 '07 #10
Yes they are click here to go to my css experiments section then click on test.html

Thanks,
Matt
May 30 '07 #11
drhowarddrfine
7,435 Expert 4TB
<link rel = "stylesheet" href = "test.css"/>

The closing /> is for Xhtml only. Remove the slash but leave the right arrow.

Here is more complete markup:
[HTML]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Css Testing</title>
<link rel = "stylesheet" href = "test.css">
</head>
<body>

<div id="RsideBar">Hello</div>
<div id = "titleLayer"></div>

</body>
</html>[/HTML]
May 30 '07 #12
Thanks! I have another question now, sorry... I want to get a layer lined up with that green bar. How would I go about doing this, I cannot use absolute or relitave positioning because depending on the size of the browser window it would show up in different places.

Thanks,
Matt
May 30 '07 #13
drhowarddrfine
7,435 Expert 4TB
In your css, position what?
Expand|Select|Wrap|Line Numbers
  1.  
  2. #titleLayer    {
  3.     background-image: url(Images/expermentGIF.gif);
  4.     background-repeat: no-repeat;
  5.     background-position: top center;
  6.     background-attachment: fixed;
  7.     height: 70px;
  8.     width: auto;
  9.     position
  10.     top: 0px;
  11. }
  12.  
May 30 '07 #14
I would like to position a layer over that green bar. The only problem is that it will be in a different place on different screens.

Thanks,
Matt
May 30 '07 #15
drhowarddrfine
7,435 Expert 4TB
Well, you can't leave that floating there cause it might confuse the browser. Just remove it for now.
May 30 '07 #16
Thanks, Im making some progress Ill check back later if I have any problems.

Thanks,
Matt
May 30 '07 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: RoDzZzZ | last post by:
when i try print (ctrl +p) my webpage, my printer not print the backgrounds and bgcolors of my tables.... what i need make to show the backgrounds and bgcolors in my paper when the user print...
6
by: MLH | last post by:
I have a logo image that I can paste into MS Paint as an image with clear background. Think of the logo as a black circle in a white, rectangular background. When I paste into Paint, the white...
0
by: ghadley_00 | last post by:
Hi, Have created 2 seperate reports that have different images as backgrounds. Would like to have both pages print out as 1 print job (so duplex printer will make each report page on opposite...
4
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
6
by: Rik Brooks | last post by:
I'm developing Web Applications with C# code behind. I have found that, because of the particular nuances of my company, I am stuck with positioning the items on the page with tables. No problem...
1
gregerly
by: gregerly | last post by:
I'm a total flash / actionscript newbie. I have a question about how to create a flash background as seen here: Adobe MAX I don't expect a detailed explanation. I'm just looking for some info...
1
by: alice | last post by:
I'm trying to have a background image in a div, then have several divs within that div that have black backgrounds. The problem I'm finding is that in Firefox and Safari, the first background image...
1
by: matturn | last post by:
Is there any way to get IE7 to render the whole viewpoint without forcing a page reload? If you set a DIV to 100% wide or high, and give it a background; that background will not be rendered if it...
5
by: Zach A and Cody C | last post by:
We are trying to make a Mario game, but we don't have a clue how to add bitmaps for the characters or backgrounds!
6
by: Johan | last post by:
I can set/change a background with: document.getElementById("photodiv").style.background = "#282828 url(../img/pict_1.jpg)"; How do I set/change multiple backgrounds using javascript?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.