Solved

how set full image in a html file

Posted on 2012-03-29
4
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

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.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

630 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