Html:stretching A Background To Page

This is a discussion on "Html:stretching A Background To Page" within the Web Page Design section. This forum, and the thread "Html:stretching A Background To Page are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 9th, 2007, 00:58
Junior Member
Join Date: Oct 2007
Location: albuquerque
Age: 19
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Html:stretching A Background To Page

I am having to make a site and I need it so the background stays the same size as the monitor resolution and so it doesn't tile it self.

<HTML>
<HEAD>
<TITLE>Welcome to the wood shop safety test</TITLE>
</HEAD>
<BODY background="cherry3.jpg">
</body>
</html>
Reply With Quote

  #2 (permalink)  
Old Nov 9th, 2007, 01:21
Reputable Member
Join Date: Dec 2005
Location: U.S.A.
Posts: 147
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to ScottR Send a message via Skype™ to ScottR
Re: Html:stretching A Background To Page

Use css with background-attachment, background-position, and background-repeat. All of which can be controlled with one background element.

body {
background: color image repeat attachment position;
}

Make sure attachment is fixed. This will not stretch the background. But it will remain the same regardless of resolution.


Good Luck,
Scott

Reply With Quote
  #3 (permalink)  
Old Nov 9th, 2007, 01:35
Junior Member
Join Date: Oct 2007
Location: albuquerque
Age: 19
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Html:stretching A Background To Page

I dont really understand what you provided me can you explain what to do with that. Thank you.
Reply With Quote
  #4 (permalink)  
Old Nov 9th, 2007, 01:43
Reputable Member
Join Date: Dec 2005
Location: U.S.A.
Posts: 147
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to ScottR Send a message via Skype™ to ScottR
Re: Html:stretching A Background To Page

I'm going to assume that you don't know CSS as send you here.

Or do a search for CSS and study a bit. CSS is Cascading Style Sheets and is used for defining the presentation of the content on your site. I would suggest a few tutorials, css can be a bit confusing at first.

Good Luck,
Scott
Reply With Quote
  #5 (permalink)  
Old Nov 9th, 2007, 07:40
Up'n'Coming Member
Join Date: Jun 2007
Location: Germany
Age: 23
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Lucleonhart Send a message via MSN to Lucleonhart
Re: Html:stretching A Background To Page

If you do not want the background to be tiled, you can simple add the no-repeat value.
If you want the background to stay at it's place, and do not scroll with the page, you need the attachment:fixed; attribute that was mentioned above.
HTML: Select all
<body style="background:cherry3.jpg no-repeat fixed top left">
That will display your background one time at the left top of the window, and it will stay there when you scroll down.

If you want to stretch the background to full screen, you have to use some divs
HTML: Select all
<body>
<div style='position:absolute; top:0px; left:0px; width:100%; height:100%; z-index:1;'>
  <img src='cherry3.jpg' style='width:100%; height:100%;'>
</div>
<div style='position:absolute; top:0px; left:0px; width:100%; height:100%; overflow:scroll; z-index:2;'>
  PUT ALL YOUR BODY CONTENT HERE!
</div>
</body>
Reply With Quote
  #6 (permalink)  
Old Nov 9th, 2007, 15:11
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Html:stretching A Background To Page

This thread might be of some help ... see posts by Aerospace_Eng
Reply With Quote
  #7 (permalink)  
Old Nov 9th, 2007, 21:08
New Member
Join Date: Nov 2007
Location: Washington
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to cbaker55 Send a message via MSN to cbaker55
Re: Html:stretching A Background To Page

You say you want the background to stay the same size according to the monitor resolution?
Set the size so that it isn't in pixels, and make it a percentage, for example, 100% to make the background fill up the entire screen no matter what resolution the computers are running.
Reply With Quote
  #8 (permalink)  
Old Nov 11th, 2007, 00:10
Reputable Member
Join Date: Dec 2005
Location: U.S.A.
Posts: 147
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to ScottR Send a message via Skype™ to ScottR
Re: Html:stretching A Background To Page

Quote:
Originally Posted by cbaker55 View Post
You say you want the background to stay the same size according to the monitor resolution?
Set the size so that it isn't in pixels, and make it a percentage, for example, 100% to make the background fill up the entire screen no matter what resolution the computers are running.

Have you tried that? It seems it would stretch the image and distort it big time. Unless the image is a gigantic!
Reply With Quote
  #9 (permalink)  
Old Nov 12th, 2007, 03:17
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Html:stretching A Background To Page

Quote:
Originally Posted by ScottR View Post
Have you tried that? It seems it would stretch the image and distort it big time. Unless the image is a gigantic!
Yes, that will happen, especially if the resolution is crazy and weird (like mine). That might not be, and probably is not, the desired effect...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking to an html page rusty149 Web Page Design 1 Feb 4th, 2008 10:34
.swf file as HTML table background bubberz Flash & Multimedia Forum 9 Jun 18th, 2007 21:45
Background page not showing up aaronh Web Page Design 4 Apr 30th, 2007 19:30
Repeating an image along the bottom of the page without setting it as background. imagius Web Page Design 9 Apr 27th, 2007 08:35
Open xml in new html page kingfrank JavaScript Forum 3 Apr 4th, 2007 11:26


All times are GMT. The time now is 09:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43