473,396 Members | 1,765 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,396 software developers and data experts.

Background image keeps being applied to ALL divs

Hi,

I have created a div with a background image, and i have now created new div's with no background image. but these new divs keep getting the first div's background image applied to them. i am not sure why. here is some of the css/style guide, the first div is the one i want with a background image, the second div i want to sit on top of the first div, with no background image.

Expand|Select|Wrap|Line Numbers
  1. div {
  2. id="background of box"
  3. width: 1000px;
  4. height: 1200px;
  5. background-image:url('images/LEFTBOX.jpg');
  6. background-repeat:no-repeat;
  7. }
  8.  
  9. div {
  10. id="images"
  11. width: 200px;
  12. height: 700px;
  13. margin: 120px 200px 70px 35px;
  14. }
i also have a problem where the background image is displaying half of it. i dont understand cos its 515px wide so it should definietly fit within the div. am i supposed to write the size of the div in the html section or on the stylesheet?

help help help! please
Apr 18 '12 #1
2 1526
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

The correct way to target CSS at an id is this:
Expand|Select|Wrap|Line Numbers
  1. #idText {}
What you have doesn't target an id.
Apr 18 '12 #2
div{......} = The css is being applied to all div tags in your document

.divClass = The css is applied to the div that has this class in your document
<div class="divClass">Some text</div>
Apr 18 '12 #3

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

Similar topics

4
by: Mimo Zus | last post by:
I'm hoping that someone can explain what's going on; better yet provide a workaround. I'm designing a centered CSS site based on a 550 pixel wide vertical background image. Onto this background...
7
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working for relative URL. e.g. If I apply following css...
16
by: Walker | last post by:
I have a span containing two words. Eg. <span>Avant Garde</span> Using CSS, I pad the text to the right and assign a background-image. Eg. span { padding: 0 3px 0 11px; background:...
1
by: Dan V. | last post by:
Does anyone know why the header looks correct in IE 6.0 and not Firefox 1.07? I am trying to have a header that looks good when you expand it wider and smaller. In other words when you shrink...
2
by: Water Cooler v2 | last post by:
I want to stretch the image so that it fills the entire cell width and height. How do I do that? <TD background="bg.gif" width="100%" height="100%" style="background-repeat: no-repeat;"> So...
3
by: seamlyne | last post by:
The first method I ever used for multiple state buttons was to create a graphic for each button for each state: AboutUs_on, AbooutUs_over, AboutUs_out, etc. That works great when there are just a...
4
by: Gary | last post by:
Hello, I want a background image to display in the extreme bottom right corner. What I have works fine in IE7 and FF2 not so in Opera 9.1 Any suggestions? Page Posted at the the link. ...
3
by: fletch | last post by:
I'm having a problem with my background image in DIVs. here is my code: CSS: #HeaderDiv { } #HeaderDivTopLeft
3
by: akapsycho | last post by:
I'm not sure if this is possible, but I thought that my best shot would be to ask here. My site's coming along well at http://www.antiriddle.com and I'm trying to improve on the current design....
1
by: farrukhm | last post by:
Hi There, I just want to know that either it is possible to set height/width of div/li etc according to width and height of their background image automatically? For example if i set the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.