Solved

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

Posted on 2011-02-11
2
301 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
[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
2 Comments
 
LVL 42

Accepted Solution

by:
David S. earned 500 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

Suggested Solutions

Title # Comments Views Activity
HTML5 storage and web apps 11 50
Html split(text) 2 31
bootstrap css color change 10 23
close pop up windows when logout or main window closes 17 54
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 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