Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

Small issue, need help asap!

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

Small issue, need help asap!

Postby soder » Mon Apr 23, 2012 9:43 am

Hey again!

I've got a small issue with my background, I've set the body h/w to 100% and the background image to h/w 100%, but if the screen resolution is too small some parts become white. I've printed my screeen of my 2 monitors(one with high and another one with low resolution)

IMAGE \/
http://i41.tinypic.com/2450lqq.jpg
IMAGE /\

CSS:
Code: Select all
body {
line-height: 1;
background-attachment:fixed;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #333;
font-size: 14px;
line-height: 18px;
background: url('images/dark.jpg');
background-repeat:no-repeat;
background-size:100% 100%;
}

The left monitor is perfectly fine, the right is the wrong one, as I need to scroll to get to the right. The part that doesnt fit the screen is white.

How do I fix this?

Regards,
Soder.
soder
New php-forum User
New php-forum User
 
Posts: 15
Joined: Fri Mar 16, 2012 7:38 pm

Re: Small issue, need help asap!

Postby garr1095 » Mon Apr 23, 2012 12:05 pm

If you are trying to stretch the background image to cover the whole screen I use this:
Code: Select all
<div id="background">
    <img src="img.jpg" class="stretch" alt="" />
</div>

for the HTML and the css is:
Code: Select all
#background {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: -1;
}

.stretch {
    width:100%;
    height:100%;
}

The z-index is the key. This comes from http://stackoverflow.com/questions/1150163/stretch-and-scale-a-css-image-background-with-css-only which I have bookmarked.

Hope this helps.
garr1095
New php-forum User
New php-forum User
 
Posts: 7
Joined: Wed Apr 18, 2012 3:21 pm

Re: Small issue, need help asap!

Postby soder » Mon Apr 23, 2012 1:49 pm

Thanks for your reply!

The issue is still the same, when I zoom in or use low resolution the part which i need to scroll to see is white :(

EDIT: Fixed, thanks alot!

Regards,
Soder.
soder
New php-forum User
New php-forum User
 
Posts: 15
Joined: Fri Mar 16, 2012 7:38 pm

Re: Small issue, need help asap!

Postby WebOutGateway » Tue Jun 03, 2014 6:20 pm

Hello!

Try setting the width and the height of the body to auto.

#body
{
width: auto;
height: auto;
}
User avatar
WebOutGateway
New php-forum User
New php-forum User
 
Posts: 33
Joined: Mon Jun 13, 2011 9:25 pm
Location: Pasig City, Philippines


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron