[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CSS Background Image

Posted on 2013-02-01
7
Medium Priority
?
286 Views
Last Modified: 2013-02-16
I have a div with a background image.  I am trying to maintain a responsive design.  However, the background image will not show without an actual height.  Any ideas or work arounds?

#in_depth {
	display:block;
	background-image:url(../img/products/icons/in-depth.jpg);
	background-repeat:no-repeat;
	min-width:50%; 
	min-height:50%;
	float:left;
	background-size:100%;
}

Open in new window

0
Comment
Question by:rgranlund
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Expert Comment

by:albacom
ID: 38844925
Try:

Height:100%; ie
Overflow:hidden; ff
0
 
LVL 7

Author Comment

by:rgranlund
ID: 38844973
that did not work
0
 
LVL 30

Expert Comment

by:LZ1
ID: 38845083
I'm not sure what your background image is or how it's being displayed, but you may want to include a responsive background as well:
http://www.onextrapixel.com/2012/03/02/using-css-background-size-responsively/
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 30

Expert Comment

by:LZ1
ID: 38845112
Here is a much better resource:
http://www.css3.info/preview/background-size/
0
 
LVL 8

Expert Comment

by:albacom
ID: 38846936
Try to define the backround-position
0
 
LVL 6

Expert Comment

by:nickinthooz
ID: 38847184
#in_depth {
	display:block;
	background:url('../img/products/icons/in-depth.jpg') no-repeat;
	min-width:50%; 
	min-height:50%;
	float:left;
	overflow: hidden;
}

Open in new window


A div will not adjust to your background size.  If you have a background image that is 300 x 300 and you only have the letter "a" inside your div, your div will collapse to the size of the "a" unless you specify a height and width. We could help a lot more if we knew what your background image was and also what is inside the div.

To see what I'm saying, use this fiddle example, take the height and width out of the div and hit run, and you'll see what I'm talking about.

http://jsfiddle.net/eZhAH/1/
0
 
LVL 8

Accepted Solution

by:
albacom earned 2000 total points
ID: 38847585
background : url("image.jpg") no-repeat center; or left top
Or
background-position: center; or left top
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question