Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
backround
#1
in html how do you stretch a backround instead of tiling it?
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#2
Look around for some CSS tutorials...
Reply
#3
Don't listen to 'em... There isnt a CSS setting but it can easily be done. If this is a main background, simply do this:

<html>
<body style="margin:0px">
<img src="anyimage.gif" style="width:100%; height:100%">
<div style="position:absolute; left:0; top:0; width:100%; height: 100%">
MAIN SITE CONTENT
</div>
</body>
</html>

You can set the width and height of an image, so you can just use layering to place the site over the background image.
Reply
#4
Too bad it gets stretched. If you want to have good quality, always, you could check for the screenmode (Screen.Width, Screen.Height) first, and then load a specific background image.
Reply
#5
Quote:There isnt a CSS setting but it can easily be done. If this is a main background, simply do this:

There isn't? I was told that the only way to do so was through CSS. Hmm... oh well. Ignore me then...
Reply
#6
...and if they have javascript turned off, neo? There's a surprising number of people doing so. And most people do not maximize their browser window.

Rockuman, CSS backgrounds are pretty nifty, especially in the case of rollovers. But background-width and background-height are not options for some reason. *shrug*


The best option is to find out what parts of your design are meant to stretch, and give them a solid color a background that can seamlessly tile.
Reply
#7
Stretching images is bad form anyway... much better to tile an image, or simply place an image and don't repeat it...

Neat CSS trick:

Code:
body {
  margin: 0;
  padding: 0;
  background-image: url(images/bg.gif);
  background-attachement: fixed;
}

Looks neat in moz firebird Smile
Reply
#8
Code:
background-attachment: fixed;
is the same as

Code:
bgproperties=fixed
in IE-specific HTML 3.2.
I'd knock on wood, but my desk is particle board.
Reply
#9
... but guess which one's gonna last longer Wink
Reply
#10
Yeah, CSS and the DOM are the best things that ever happened to HTML. But I wish they'd let you use math for CSS values. Something like this could be extraordinarily cool:

Code:
div#myblock {
        position:absolute;
        top:div#block2.top;
        left:div#block2.right - 40px;
}

While stuff like that is possible without math, it'd be sooo much easier with. They made a protocol once for it, but it died in whatever subcomittee they have.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)