Solved

how set full image in a html file

Posted on 2012-03-29
4
163 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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.
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.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 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