Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do i use the CSS background property to do this?

Posted on 2011-03-22
4
Medium Priority
?
187 Views
Last Modified: 2013-09-15
Hi guys,

I really need some help with a background on a website. You can see the image here:

Test Background
Now what i want is first of all to have the image placed in the top middle. Then i would like to have something like 10x250px (Width x Height) from the left of the image to be repeated - should a visitors screen resolution be wider than the image it won't seem like the site just stops at the edges.

I've tried several things, but it seems i keep running into different kind of technicalities that I'm not sure how to get around. So I would like to know how you would do it?

(The websites content will be 990px wide if that helps)
0
Comment
Question by:rogueparagon
[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
4 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35194958
not sure if i have understood, but you can specify the position of the background image
http://www.w3schools.com/css/pr_background-position.asp
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 35195147
Here's how to do it.  And it will demonstrate one of the problems.  If the colors are not an exact match like you have with a gradient, you will see the line where the images switch.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!-- 
body { 
	margin: 0;
	background-image: url(test-bg-01-1.jpg);
	background-repeat:repeat-x;
	}

#wrap {
	margin-left: auto;
	margin-right: auto;
	background-image: url(test-bg-01.jpg);
	background-position: top center;
	background-repeat:no-repeat;	
	width:1050px;
	height: 350px;
	} 
-->
</style>
</head>
<body>
<div id="wrap">
&nbsp;<br />

</div>
</body>
</html>

Open in new window

test-bg-01-1.jpg
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

719 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