473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Positioning the body background starting from container end

KeredDrahcir
426 256MB
I have a container that is 980 pixels wide. I want a background of the main page (the body) to start from the right of the container and continue as far right as the browser window goes, or until the image ends (whichever is sooner).

It I position the background image like this:
Expand|Select|Wrap|Line Numbers
  1. body    {
  2.     margin: 0;
  3.     font-size: 10pt;
  4.     line-height: 1.4em;
  5.     text-align: center;
  6.     background: url(images/image.jpg) no-repeat 980px top;
  7. }
Then the background image will start 980 pixels from the left hand edge of the browser window but that means it will only work on one particular screen resolution.

I tired positioning an element with the background but that went off the edge of the screen and when I tried to hide the overflow, but that meant you couldn't scroll the main page to see the content on the low resolution or high zoom.

Is there a way to take the centre and then add 490 pixels to it so it will start from the end of the container?
Mar 7 '14 #1

✓ answered by KeredDrahcir

This is the way to do it:
Expand|Select|Wrap|Line Numbers
  1. background-position: calc(50% + 490px) top;

2 1245
KeredDrahcir
426 256MB
Isn't anyone prepared to help me?
Mar 10 '14 #2
KeredDrahcir
426 256MB
This is the way to do it:
Expand|Select|Wrap|Line Numbers
  1. background-position: calc(50% + 490px) top;
Mar 11 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Unknown User | last post by:
Here's my page: http://www.abahia.com/smartads/ I want the beige background all over the page. It works fine in Opera 8, in IE 5.5 and 6, in Maxthon, but in Mozilla, there is a large white margin...
10
by: Richard Steele | last post by:
Can anyone help me I am developing an application runs on a PC (client) only. For graphical reasons it was decided that the content would be displayed in a Browser that is embedded in a Windows...
4
by: ruca | last post by:
How can I set body background with an image, but centered and not tiled? When I put background="image1", it fills my page with the image many times. I only want to put at the beggining and...
2
by: Just D. | last post by:
Who knows what should we include into aspx file to show some image as a background picture but only once at the top of the page? I don't want to add the Image control because even if it uses a...
9
by: frizzle | last post by:
Hi there, I have a site where i display all kinds of thumbnails, (all 100 * 100px), the thumbs are links (surprise! ;) ). They link to a page where someone can order the picture. If ordered, a...
2
by: guest | last post by:
how to : another body background every day?
6
by: sooshi | last post by:
Hi all, The height of my page needs to be flexible as the page contains columns with lists which can vary in length. I also have a footer which needs to be stuck to the bottom. I managed to do...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.