Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Background-position fails to work as expected in IE and FF
Old 09-03-2006, 11:50 AM Background-position fails to work as expected in IE and FF
Shrapnel's Avatar
Junior Talker

Posts: 1
Name: Matt
Location: Savannah, GA
Trades: 0
So I'm a bit of a n00b when it comes to CSS. Actually, I'm a total n00b. I'm a visual designer who's trying to build on my webcoding skillz, with a couple of nice-looking but not-rocket-science HTML sites to my credit, and I'm trying to enter the modern age and learn CSS. To do so, I've picked up a book called 'Integrated HTML and CSS' (Sybex, 2005) and am going through it page by page, exercise by exercise. I'm only on page 44, and I'm already stymied, as the book's demonstration of 'background-position' in no way reflects how my browsers are acting. (For the record, I'm a Firefox user, but I recognize that IE has yet to be toppled as a the dominant beast.)

What I'm working with right now is an HTML document consisting of

<!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>
<title>My First Practice Page</title>
<link href="ch3practice.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>Hello, world</p>
</body>
</html>


and a style sheet consisting of

body {
background-color: #9CC;
background-image: url(ch3bg_sm.gif);
background-repeat: repeat-y;
background-position: 100% 50%;
margin-top: 10%;
margin-left: 15%;
}


Couldn't be simpler, yes? Well, the book claims that the background-position declaration (more specifically, the "50%" part) will make a silly starflake picture repeat across the middle of the page. Which it does, in IE... though I've discovered that IE apparently defaults that value to 50% (center) even if I remove the value completely, and only have a specifier for the x-axis. (i.e. background-position: 100%) Is that right?

What's more important to me, though, is that apparently Firefox does not even register any kind of y-axis specifier. That stupid snowflake just sits along the top of the window, no matter what value I put in. (I've already read a dissertation on the browser compatibilities associated with percentage/pixel/keyword value combinations... I don't think that's the issue, but then, I'm clueless anyways.)

In short, I feel like a grown man who can't figure out why the square peg won't fit into the round hole. I hate to take up bandwidth with such a piddly little issue, but I'd like to know I'm not starting out on the wrong foot. Any wisdom is greatly appreciated. Thanks!
Shrapnel is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-03-2006, 01:03 PM Re: Background-position fails to work as expected in IE and FF
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
I tend not to use percentages because I've always found them a bit flaky. I prefer "top/bottom/center" and "left/right/center".

That may well work for what you're trying to accomplish.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Background-position fails to work as expected in IE and FF
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28325 seconds with 12 queries