Solved

how set full image in a html file

Posted on 2012-03-29
4
162 Views
Last Modified: 2012-04-02
hi

i have an html file , and i have a bakground image and i need it set to 100% browser, but it let me a grey space at right

someone could help me pleasae

thanks a lot
error-image-size-100.JPG
index.html
0
Comment
Question by:tenriquez199
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Ben McNelly
ID: 37784333
CSS3 way, needs more code to get working in IE8 and below, but works in 9

html {
	background: url(images/bg.jpg) no-repeat center center fixed;
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;
}

Open in new window


for IE8 and below add in
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='.myBackground.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='myBackground.jpg', sizingMethod='scale')";

Open in new window

0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 500 total points
ID: 37784355
There are some CSS3 features that might help you. I haven't used them yet. Here's a good reference: w3schools.com
0
 
LVL 1

Author Comment

by:tenriquez199
ID: 37784410
benmcnelly

thanks

where put that code? at block body?
0
 
LVL 8

Expert Comment

by:Ben McNelly
ID: 37796407
@xmediaman, enjoy your poinks ;)

In regards to placing the code on the page to do this you need to locate where (if at all) you are loading in or using CSS on your page. You can link to an external stylesheet or place the code in the page directly. The safest way to use the above coded is to place it between a style tag at the end of the HEAD section. It will overide any previous CSS (see this for refrence http://www.nzwhost.com/article/understanding-css-hierarchy )

Here is how it would be implemented on the page you attached... sample: http://benmcnelly.com/EE/example.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">

html {
	background: url(http://newevolutiondesigns.com/images/freebies/hd-wallpaper-33.jpg) no-repeat center center fixed;
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;
}

body {
	font-size: 14px;
	padding-left: 200px;
	padding-top: -10px;
	position: absolute;
	top: 10px;
	background-repeat: no-repeat;
	background-size : 100%;
	width: 100%;
	height: 100%;
}

Open in new window

0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

777 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