[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can you use repeat when using the css 2.1 "content: url"?

Posted on 2011-02-11
2
Medium Priority
?
333 Views
Last Modified: 2012-05-11
I need to stretch an image across the entire background of a website regardless of resolution and screen size.  I came across the following article: http://nicolasgallagher.com/multiple-backgrounds-and-borders-with-css2/.  Here is the problem, if I go this route, can I use repeat when I use "content: url(.......)" like "content: url(........) repeat-x"?  If this is not the approach to use, could you please provide me with alternative approaches.  I have found several examples, but they seem to be rather complex.  any help would be greatly appreciated.  If this helps, it needs to be cross-browser.
0
Comment
Question by:rawcoder
2 Comments
 
LVL 43

Accepted Solution

by:
David S. earned 2000 total points
ID: 34877163
No, using the content property is more like adding an <img> element than a background image.

However, you can apply a background image to a ":before" pseudo-element. This does not work in IE7 though.
selector:before {
	content: '\A0'; /* non-breaking space character */
	display: block;
	width: 100%;
	height: 50px;
	background: url(example.png) repeat-x;
}

Open in new window

0
 
LVL 16

Expert Comment

by:s8web
ID: 34883069
Here's an alternative approach that might interest you. I use this type of thing for login pages.

http://s8web.com/ee/bgimgscale/ 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

834 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