473,799 Members | 3,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

background-image getting cut off outside original window display

I've set a background image to repeat-y and at 100% height. It appears
fine when I open the window, but when I resize to a smaller height so
that I must scroll down to see the rest, the background image is
suddenly gone from the bottom.

#background {
position: absolute;
top: 0px;
bottom: 0px;
left: 50%;
margin-left: -370px;
background-image: url(images/background.gif) ;
background-repeat: repeat-y;
width: 740px;
height: 100%;
}

see here: http://www.kndesign.net/index2.htm

I've tried turning off the background repeat but that doesn't seem to
work (although it's not shown in the css, just have to trust me that I
tried it). Can anyone help? I'm fairly new to this so the answer may be
obvious to everyone else.

Dec 16 '06 #1
3 27217
A few edits here: the no-repeat fix IS in the css so you don't have to
trust me. Also, the subject says original window display but that's not
accurate, it's basically showing the background at the size of the
window and anything taller than that is cut off at the bottom.

Dec 16 '06 #2
On 2006-12-16, KNDesign <kn******@gmail .comwrote:
I've set a background image to repeat-y and at 100% height. It appears
fine when I open the window, but when I resize to a smaller height so
that I must scroll down to see the rest, the background image is
suddenly gone from the bottom.

#background {
position: absolute;
top: 0px;
bottom: 0px;
left: 50%;
margin-left: -370px;
background-image: url(images/background.gif) ;
background-repeat: repeat-y;
width: 740px;
height: 100%;
}

see here: http://www.kndesign.net/index2.htm

I've tried turning off the background repeat but that doesn't seem to
work (although it's not shown in the css, just have to trust me that I
tried it). Can anyone help? I'm fairly new to this so the answer may be
obvious to everyone else.
height: 100% means 100% of the viewport height. You might think that
would be recalculated if the viewport was resized, but it isn't in any
browser I know (and the CSS spec does say that 100% refers to an
"_initial_ containing block").

Really you want your background image to be the height of the body
element, not the height of the viewport.

So why not get rid of the background div altogether, and add to the body
selector something like this:

background-image: url(images/background.gif) ;
background-repeat: repeat-y;
background-position: center top;

By the way you have a dodgy comment at the top of your stylesheet
css.css

//* CSS DOCUMENT *//

that was causing the whole body selector to be rejected for me. Change
it to

/* CSS DOCUMENT */

Or better still just delete it altogether since it's not exactly a very
informative comment!

I'm not quite sure what you were up to with left:50%, margin-left:-370px
on the #background div anyway. background-position may be just as good
or better a way to position your background image.
Dec 16 '06 #3
thanks for the help!

moving the background image and repeat-y to the body and centering it
fixed the problem. thanks for the note about the css comment, i don't
even know why it's in there and took it out.

Dec 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6742
by: Stanimir Stamenkov | last post by:
Here are two cases regarding inline-level elements' line-height, padding and background, which I doesn't understand: <div style="background: black; color: white; line-height: 1.5"> <span>Abc</span> <span style="background: white; color: black; line-height: 3">Abc</span> <span>Abc</span> </div>
1
6761
by: dhunter | last post by:
I'm kind of new to CSS and hope someone knows how to fix a problem I've been fighting with for days. I'm trying to create a mouseover navbar with CSS which inserts a colored background JPG that fills a transparent cell using "a:hover" and inserts a different colored JPG after you click on the link and are on the linked page ("a:active" I assume). My current test works fine (at least on the "a:hover" part) but the background won't fill...
7
5806
by: ryan.fairchild | last post by:
Ok I basically am creating a container for a bunch of other <div> tags. But I want to make four jpegs/gif/whatever that goes in each corner so they look rounded. I thought this is how I would do it but I could be wrong. body { background:#999 url("http://") no-repeat top left; background/* */:/**/url("http://") no-repeat top right; background: /**/url("http://") no-repeat top right;
8
5045
by: Serge Hartmann | last post by:
hi there, I created two different backgrounds for the same page to obtain a (fake) left margin and a (true) right margin. -> left background, defined in body section, aligned bottom and with vertical repeat. -> right background, defined in html section, aligned top and without repeat it may look weird, but I don't think my problem is due to these margins.
3
6006
by: Mr. T. | last post by:
Hello, i have a page where i have a white box centered on the screen. Now in IE everything shows fine, but in FireFox and Netscape the background of the box isn't white. But all the positioning is more or less OK. This is the code of my page: <div class="centraal"> <div class="whitebox">
1
1756
by: P.Singh | last post by:
hi all i am designing a website for a charity origanisation. they cater towards the senior crowd. i would like to have choice by which the user can change the background as required (like beige/grey/aqua etc.) and also the text color/font and browse the site with that background and text color . will i need to make different copies of the site and link them together.
4
9835
by: Keon | last post by:
Hoi Do someone know how i can make the background of a iframe transparancy? I already tried it with filter: Alpha(Opacity=50,); but it also make the text transperancy. do someone know how to do this? greetings Koen
6
56644
by: Nancy Carter | last post by:
I'm trying to set the background color of a frameset to black. The following code doesn't work in either IE 6.0 or Firefox. Any ideas why? <frameset bgcolor="#000000" frameborder="0" border="0" cols="240,*"> <frame name="links" scrolling="no" noresize target="contents" src=""> <frameset bgcolor="#000000" frameborder="0" border="0" rows="135,*"> <frame name="topbanner" scrolling="no" src="">
2
2864
by: bissatch | last post by:
Hi, I am running a w3c CSS validation check on a site in development. I have many errors saying that my CSS is not valid because I have not defined the background-color but instead left it default transparent. Why does it require that every CSS defined element have their background-color defined? Also, when I set styles in the following way:
6
9679
by: Francois Bonzon | last post by:
Any idea how I can launch a background task from a PHP script? For example, when a user posts on my message board, it may fire many e-mail notifications to other users, and other tasks. I want the posting confirmation page to end displaying quickly, without waiting for those notifications or other tasks to complete. So basically what I want is to launch 'background.php' from 'main.php', with the user seeing only the output of - and...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.