473,396 Members | 2,009 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.

Can't get images to display in CSS

rush it
18
I'm working on a psuedo project. It's just for experience. However, I will soon be working on a project that I'll need this skill for.

I sliced a .psd and am writing the html and css to build two pages: home and about us. I'm not very experienced at writing css from the ground up. I've done more with adjusting existing CSS on projects. I've been scouring forums and have made many adjustments, but none has worked.

I can get the top two images to appear in the top header, along with social buttons (twitter, etc.) but can't get the images or background for the bottom header to appear, or the image below that. I've tried replicating what worked with the other images, but to no avail. I don't know if it's a matter of when I should use ID's and when I should use classes in html or not. I've tried switching those around in some areas, then changing the CSS to reflect that. I'm at wit's end.

Can anyone see what's wrong with my code? I'm not sure if it will work without the images. Unfortunately, they belong to a client and I don't think I can attach them. I've validated the CSS and HTML on W3C and they're good. The CSS at the bottom is not finished and I'm sure I'll add more to the HTML. I decided I'd spent too much time trying to figure it out myself and wanted to get something posted here. Remember, I'm not very experienced with from-the-ground-up CSS, so please don't assume I know what you're talking about. Cheers.

My CSS:

Expand|Select|Wrap|Line Numbers
  1.  
  2. body
  3. {
  4. font-family:Arial;
  5. font-weight:bold;
  6. font-size:12px;
  7. color:#3f4a4e;
  8. margin:0; 
  9. padding:0;
  10.  
  11. }
  12.  
  13. /*==============================
  14. PAGE WRAPPER
  15. ===============================*/
  16.  
  17. #page
  18. {
  19. width: 1150px;
  20. min-height:600px;
  21. margin-left:auto;
  22. margin-right:auto;
  23. }
  24.  
  25. /*==============================
  26. HEADER WRAPPER
  27. ===============================*/
  28.  
  29. #top-header
  30. {
  31. width:980px;
  32. background: url(images/topgraybar.png);
  33. height: 57px;
  34. background: #dcdcdc;
  35. background-image: url(images/logo.png);
  36. background-repeat: no-repeat;
  37. margin: 0 auto 0 auto;
  38.  
  39. }
  40.  
  41. ul 
  42. {
  43. float:left;
  44. margin-left: 350px;
  45. width:100%;
  46. list-style-type:none;
  47. height:20px;
  48. padding-top: 20px;
  49. position: absolute;
  50.  
  51. }
  52.  
  53. {
  54. float:left;
  55. text-decoration:none;
  56. color:#808080;
  57. padding: .6em;
  58.  
  59. }
  60.  
  61. a:hover 
  62. {
  63. background-color:#cc3300;
  64.  
  65. }
  66.  
  67. li 
  68. {
  69. display:inline;
  70. padding: 2.2em;
  71. margin: 0 auto 0 auto;
  72.  
  73. }
  74.  
  75.  
  76. /*social buttons*/
  77.  
  78. .twitter
  79. {
  80. background-image: url(images/twitter.png);
  81. background-repeat: no-repeat;
  82. margin:-1px 80px auto 745px;
  83. padding-top: 80px;
  84. padding-bottom: 30px;
  85. position: relative;
  86. float:right;
  87. width:8.5%;
  88. }
  89.  
  90. .facebook
  91. {
  92.  
  93. background-image: url(images/facebook.png);
  94. background-repeat: no-repeat;
  95. margin:-110px 40px auto auto;
  96. padding-top: 50px;
  97. padding-bottom: 30px;
  98. position: relative;
  99. float:right;
  100. clear:right;
  101. width:9%;
  102. }
  103.  
  104. .rss
  105. {
  106. background-image: url(images/rss.png);
  107. background-repeat: no-repeat;
  108. margin:-111px 40.5px auto auto;
  109. padding-top: 100px;
  110. padding-bottom: 30px;
  111. position: relative;
  112. float:right;
  113. width:5%;
  114. }
  115.  
  116. /*second header (orange bckgrnd, pic of men, etc.)*/
  117.  
  118.  
  119. .btm-background
  120. {
  121. background: url(images/orangebckgrnd.png);
  122. background-repeat: repeat;
  123. float:left;
  124.  
  125. }
  126.  
  127. .top-pic
  128. {
  129. background-image: url(images/mainpic.png);
  130. float:left;
  131. margin-left:75px;
  132.  
  133. }
  134.  
  135. .btm-block
  136. {
  137. background: url(images/blackblock.png);
  138. float:right;
  139. margin-right:75px;
  140. }
  141.  
  142. .black-arrow
  143. {
  144. background-image: url(images/blackarrow.png);
  145. float:left;
  146. margin-left:65px;
  147.  
  148. }
  149.  
  150. .red-arrow
  151. {
  152. background-image: url(images/redarrow.png);
  153. float:right;
  154. margin-right:65px;
  155. }
  156.  
  157. /*==============================
  158. BODY WRAPPER
  159. ==============================*/
  160.  
  161. #body-wrapper
  162. {
  163. margin-top:350px;
  164. float:left;
  165. width:800px;
  166.  
  167. }
  168.  
  169. .intro
  170. {
  171. margin-top: 250px;
  172. }
  173.  
  174. .tower
  175. {
  176. clear:left;
  177. float:right;
  178. margin:500px 85px auto auto;
  179. padding-top: 35px;
  180. }
  181.  
  182. .under-tower
  183. {
  184. clear:left;
  185. float:right;
  186. margin:800px 85px auto auto;
  187. }
  188.  
  189. .thumbone
  190. {
  191. background-image: url(thumbone.png);
  192. margin: 875px 165px auto auto;
  193. float:right;
  194. clear:right;
  195. }
  196.  
  197. .thumbtwo
  198. {
  199. background-image: url(thumbtwo.png);
  200. margin: 875px 150px auto auto;
  201. float:right;
  202. clear:right;
  203. }
  204.  
  205. .thumbthree
  206. {
  207. background-image: url(thumbthree.png);
  208. margin: 875px 1115px auto auto;
  209. float:right;
  210. clear:right;
  211. }
  212. /*==============================
  213. FOOTER
  214. ===============================*/
  215.  
  216. .serration
  217. {
  218. background: url(images/btmgraydot.png);
  219. float:left;
  220. position:absolute;
  221. margin:200px auto 0 auto;
  222. }
  223.  
  224. .first-footer
  225. {
  226. background: url(images/blackfooter.png);
  227. }
  228.  
  229. .first-quote
  230. {
  231. background: url(images/blackfooterquote.png);
  232. }
  233.  
  234. .second-footer
  235. {
  236. background: url(images/grayfooter.png);
  237. }
  238.  
  239. .second-quote
  240. {
  241. background: url(images/grayfooterquote.png);
  242. }
  243.  
  244.  
Expand|Select|Wrap|Line Numbers
  1.  
  2. My HTML:
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8.     <title>Company Name</title>
  9.     <link rel="stylesheet" type="text/css" href = "style.css"  media="screen"  />
  10. </head>
  11.  
  12. <body>
  13. <div id="page">
  14.     <div id="header" >
  15.         <div id="top-header">
  16.             <ul class="nav">
  17.                 <li><a href="whatwedo.html">What We Do</a></li>
  18.                 <li><a href="approach">Our Approach</a></li>
  19.                 <li><a href="experience">Our Experience</a></li>
  20.                 <li><a href="news">News</a></li>
  21.                 <li><a href="about">About Us</a></li>
  22.                 <li><a href="careers">Careers</a></li>
  23.                 <li><a href="contact">Contact Us</a></li>
  24.             </ul>
  25.  
  26.             <div id="social">
  27.                 <div class="twitter"></div>
  28.                 <div class="facebook"></div>
  29.                 <div class="rss"></div>
  30.             </div>
  31.         </div>
  32.  
  33.         <div id="btm-header">
  34.             <div class="btm-background"></div>    
  35.             <div class="top-pic"></div>
  36.             <div class="btm-block"></div>
  37.             <div class="black-arrow"></div>
  38.             <div class="red-arrow"></div>
  39.         </div>
  40.     </div>
  41.     <div id="body-wrapper">
  42.         <div class="intro">
  43.             <p>Since 1969, Acme Company has been delivering quality products throughout the greater...</p><br /><br />
  44.             <div class="tower"></div>
  45.             <div class="under-tower"></div>
  46.             <div class="thumbone.png"></div>
  47.             <div class="thumbtwo.png"></div>
  48.             <div class="thumbthree.png"></div>
  49.         </div>        
  50.     </div>    
  51. </div>
  52.  
  53. <div id="footer">
  54.         <div class="serration"></div>
  55.         <div class="first-footer">
  56.             <div class ="first-quote"></div>
  57.         </div>
  58.         <div class="second-footer">
  59.             <div class="second-quote"></div>
  60.         </div>
  61. </div>
  62.  
  63.  
  64. </body>
  65. </html>
  66.  
  67.  
Dec 13 '11 #1

✓ answered by drhowarddrfine

You have your class name in the divs as the name of the source image, such as "thumbthree.png". It should just be "thumbthree" in that instance.

Also, the divs have no content and you haven't set a width/height, so they will collapse to nothing.

3 2470
drhowarddrfine
7,435 Expert 4TB
You have your class name in the divs as the name of the source image, such as "thumbthree.png". It should just be "thumbthree" in that instance.

Also, the divs have no content and you haven't set a width/height, so they will collapse to nothing.
Dec 13 '11 #2
rush it
18
I'm now getting my images to display. I started giving my images more parameters: heights, margins, padding, clears, floats. I just kept experimenting to see what each image needed. The first image popped up so quickly that I thought something was wrong. I'm such a CSS newb that I didn't realize that the position of the image determines which or how many settings it needs. Lesson learned. For today.
Dec 15 '11 #3
drhowarddrfine
7,435 Expert 4TB
Images don't need anything to display but, in this case, you are using background images so it's the containing element itself that needs additional stuff.
Dec 15 '11 #4

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

Similar topics

32
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is...
4
by: Paul LeBlanc | last post by:
I have some images that move positions fine using onmousedown or onmousemove to feed a function the coordinates. It doesn't work when I plug it into conditional loops with setTimeout to set the...
5
by: Oenone | last post by:
This may be a bit of a long shot... I've been working with the excellent new ReportView libraries in VS2005. Until this afternoon I've been extremely happy with everything I've seen them do....
2
by: Russ Jones | last post by:
On a web site I'm working on, some of the images display in IE7 but not in Firefox 2.0. You can see it at http://members.cox.net/rjwh/snark/fit_ 1.html. In the body of the poem, right before the...
1
by: bravephantom | last post by:
how can i save images on my database using ms access? thnx for help
3
by: Dave | last post by:
I have an ASP 3.0 website on which the images are displaying intermittently. In other words, when I request a page, the image is blank. There is no missing image place marker (rectangle with a...
2
hsriat
by: hsriat | last post by:
Maximum how many elements can be made hidden by giving STYLE={DISPLAY:NONE} in a single HTML file. Any restriction?... If it is there.. any way out as I want to make 110 rows with DISPLAY:NONE...
6
by: shanmugamit | last post by:
hi, i use session for every page.in each page i submit the form and get value.if i press back button in IE previous page can't be display.without submit a form it will display the previous...
1
by: sulabhprofit | last post by:
suppose i m a administrator............and i m finding a error message "page can't be display" while i have connected net to my PC..............what should i do
6
by: simon2x1 | last post by:
i want an inputed value that a user enter into the textfield should remain after clicking submit and an error message display that invalued email.the email textfield will be blank why the other...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.