Wrox Programmer Forums
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2013, 11:28 PM
Registered User
 
Join Date: Aug 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Div background doesn't show

Pretty common problem, judging from what i've been seeing so far. Most of the time it's url problem or backslashes etc. Not this time though...

My code
Code:
<div id="est"></div>
Code:
#est {
	margin-left:55px;
    margin-top:55px;
	background-image: url(http://blabla.com/wp-content/themes/blankslate.3.3/blankslate/images/est.jpg);
	background-repeat: no-repeat;
	}
I've been trying everything. Local url/full url, quotation marks (single and double), bacground-imgage:/background. No luck...
Thanks in advance!
 
Old February 3rd, 2015, 03:34 PM
Registered User
 
Join Date: Feb 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

An <img> placed inside a container like your div has dimensions that will "stretch" that container around it by default. That's because the item is something that fits into that container.

Styling a background image falls outside of the document content and merely "paints" it into what you specify. If that div you want a background on has no content in it and has no defined area then nothing will show. Set your #est div width and height or place content into it to "stretch it" and you will see your background displays as you intend.

e.g.
#est {
margin-left:55px;
margin-top:55px;
width: 300px;
height:100px;
background-image: url(http://blabla.com/wp-content/themes/...ages/est.jpg);
background-repeat: no-repeat;
}
 
Old February 1st, 2018, 06:52 AM
Registered User
 
Join Date: Jan 2018
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

If you don't have any content inside the div, the background image won't be displayed. Try adding a small paragraph inside the div and test if it works. I know you don't need content there. But please try this and tell if it works.

If it works, I will tell you a workaround for this issue.


Regards,

Pavithra
Spidergems





Similar Threads
Thread Thread Starter Forum Replies Last Post
DIV CSS background-image does not display StevenF ASP.NET 3.5 Basics 7 February 2nd, 2010 06:22 PM
Background image in DIV not displaying creative_eye CSS Cascading Style Sheets 3 December 31st, 2009 04:05 PM
Help need fixed background on a scrollable div birthdayzoot CSS Cascading Style Sheets 3 June 20th, 2007 02:15 PM
Background Image problem in DIV tag. cumminsj CSS Cascading Style Sheets 6 September 15th, 2006 03:02 AM
background image for <div> anshul CSS Cascading Style Sheets 4 May 16th, 2005 11:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.