A Digital Age Deserves A Digital Leader

Code request Thread

Postby gorbachev » Thu Aug 05, 2004 1:08 pm

imnuts wrote:maybe you can help with this. i have seen many sites where the background is a static image and when you scroll down, the text moves and the background doesn't. how do they do that cause i want my site to be like that.


There is a much simpler way than the ones others have told you, a simple property value

Below is an example where image.gif is where u insert the name of your bg image

Code: Select all
<body background="image.gif" background="fixed">
PRO Level 3
User avatar
Posts: 67
Joined: Wed Aug 04, 2004 7:23 pm
Location: United Kingdom

Postby imnuts » Thu Aug 05, 2004 1:13 pm

i got it now and thanks to that site, i have good CSS style and have learned a lot about the style sheet. it makes it a lot easier to manipulate objects than html does
Image
PRO SUPREME
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Postby Weaver » Thu Aug 05, 2004 2:30 pm

gorbachev wrote:
imnuts wrote:maybe you can help with this. i have seen many sites where the background is a static image and when you scroll down, the text moves and the background doesn't. how do they do that cause i want my site to be like that.


There is a much simpler way than the ones others have told you, a simple property value

Below is an example where image.gif is where u insert the name of your bg image

Code: Select all
<body background="image.gif" background="fixed">


Sorry bud, but that isn't even remotely close to valid HTML. It is very poor practice to use the above method (if it even works). Maybe you were trying to get at the CSS equivalent. I'll post it below.

Code: Select all
<body style='background: image.gif fixed;'>
<!-- Or, if you don't want to do it all in one statement, use the one below -->
<body style='background-image: image.gif; background-attachment: fixed;'>


-Weaver
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby [Dima] » Thu Aug 05, 2004 2:56 pm

I need a code for my site which would make a box scroll = news scrolling block. Its quite small and can be transparent which will have txt/images scrolling inside of it up or down :yesnod:

thank you
[Dima]

Postby gorbachev » Thu Aug 05, 2004 4:15 pm

Weaver wrote:
gorbachev wrote:
imnuts wrote:maybe you can help with this. i have seen many sites where the background is a static image and when you scroll down, the text moves and the background doesn't. how do they do that cause i want my site to be like that.


There is a much simpler way than the ones others have told you, a simple property value

Below is an example where image.gif is where u insert the name of your bg image

Code: Select all
<body background="image.gif" background="fixed">


Sorry bud, but that isn't even remotely close to valid HTML. It is very poor practice to use the above method (if it even works). Maybe you were trying to get at the CSS equivalent. I'll post it below.

Code: Select all
<body style='background: image.gif fixed;'>
<!-- Or, if you don't want to do it all in one statement, use the one below -->
<body style='background-image: image.gif; background-attachment: fixed;'>


-Weaver




Actually, your highness, the method I posted is valid html and has been in use for decades, it works perfectly, and the fact that it doesnt require half a page of coding like your method suggests it is more efficient...its ok to be wrong sometimes. chill
<img src="http://zybox-media.com/SIG2BRIT4LIFE.jpg" width="492" height="151">

BRING HOME THE GOLD BRITAIN...YOUR COUNTRY SUPPORTS YOU!
PRO Level 3
User avatar
Posts: 67
Joined: Wed Aug 04, 2004 7:23 pm
Location: United Kingdom

Postby imnuts » Thu Aug 05, 2004 4:34 pm

hate to tell you, but weaver's right and you're wrong. i just editted a page that i copied all necessary files for with your tag and saved it. the page came up with the background i wanted and the background repeated down the page and the text didn't scroll on it. to see what i'm talking about with the text scrolling go here
Image
PRO SUPREME
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Postby gorbachev » Thu Aug 05, 2004 4:43 pm

Sorry I made a typo, where it says
Code: Select all
<body background="image.gif" background"Fixed">
it should infact read
Code: Select all
<body background="image.gif" bgproperties="Fixed">


Give that a shot and tell me I am wrong...better yet go here and see an example for yourself. The tag used in that example is
Code: Select all
<body background="twatbg.png" bgproperties="Fixed">
<img src="http://zybox-media.com/SIG2BRIT4LIFE.jpg" width="492" height="151">

BRING HOME THE GOLD BRITAIN...YOUR COUNTRY SUPPORTS YOU!
PRO Level 3
User avatar
Posts: 67
Joined: Wed Aug 04, 2004 7:23 pm
Location: United Kingdom

Postby Weaver » Thu Aug 05, 2004 5:08 pm

gorbachev wrote:
Weaver wrote:
gorbachev wrote:
imnuts wrote:maybe you can help with this. i have seen many sites where the background is a static image and when you scroll down, the text moves and the background doesn't. how do they do that cause i want my site to be like that.


There is a much simpler way than the ones others have told you, a simple property value

Below is an example where image.gif is where u insert the name of your bg image

Code: Select all
<body background="image.gif" background="fixed">


Sorry bud, but that isn't even remotely close to valid HTML. It is very poor practice to use the above method (if it even works). Maybe you were trying to get at the CSS equivalent. I'll post it below.

Code: Select all
<body style='background: image.gif fixed;'>
<!-- Or, if you don't want to do it all in one statement, use the one below -->
<body style='background-image: image.gif; background-attachment: fixed;'>


-Weaver




Actually, your highness, the method I posted is valid html and has been in use for decades, it works perfectly, and the fact that it doesnt require half a page of coding like your method suggests it is more efficient...its ok to be wrong sometimes. chill


It would appear as if there is some confusion as to what the word "valid" implies. In the web development community, when someone drops the word "valid," the concept of "validation" is implied. For example, when I said "is not valid HTML" I implied that the particular code segment would not pass validation. What is validation? Validation generally involves feeding your markup through a parser that checks for allowed tags, allowed attributes, proper semantics, proper nesting, and some other qualities. The de facto standard validator/parser is the World Wide Web Consortium's Markup Validation Service, located at http://validator.w3.org/ .

To dive into specifics, the code you posted is as follows.

Code: Select all
<body background="image.gif" background="fixed">


There are a few things wrong with this particular piece, most semantic in nature. The obvious problem, from a markup standpoint is that you are defining the same attribute twice in a single tag. Semantically, this is should not be allowed and is bad practice. Syntactically, this is not allowed either.

What you may have been trying to get at is the bgproperties attribute that is a Microsoft "addition" to HTML. The specific code you posted is both semantically and syntactically wrong regardless of the definition of "valid" you choose to use. The specific attribute needed is bgproperties, not a redefintion of background. As mentioned about a sentence ago, bgproperties is not standard across browsers nor is it "valid" HTML. Microsoft even admits it is not a standard (See "Standards Information" at bottom of link).

Now on to your "analysis" of my posted code. A standard page is typically defined as somewhere between 50-65 lines. Depends on many factors. Simple math would tell us that a half-page of code would be somewhere in the range of 25-33 lines. I posted three lines of code total, far from the half page guesstimate. Furthermore, if you read the code you will note that 33% of the code is commenting. In addition, the remaining 66% is comprised of two separate examples that accomplish the same thing, one way being a shorthand version of the other.

To finish, to accomplish using published standards what your code "allegedly" does in a percentage of browsers, a single line of either example that I posted should work, assuming the browser supports CSS1. Since the maximum length of code necessary to work in all of our cases is no more than a single line, I fail to see how yours is more efficient.

-Weaver

EDIT: @gorbachev: Your correction is noted. However, nearly all of my post stills remains applicable.
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Postby gorbachev » Thu Aug 05, 2004 5:13 pm

K, i skimmed over your book. You made some interesting points and I filed them accordingly, can't wait for bin day. I said that my method was simpler as it didnt require half a page of code. It is now up to the ppl who read what I have posted to decide whether they want to use a simple method that works fine... or use your method in the hope of winning a W3 award for their personal site. Ok so your an admin... doesn't give you the right to be stuck up...get a life.
<img src="http://zybox-media.com/SIG2BRIT4LIFE.jpg" width="492" height="151">

BRING HOME THE GOLD BRITAIN...YOUR COUNTRY SUPPORTS YOU!
PRO Level 3
User avatar
Posts: 67
Joined: Wed Aug 04, 2004 7:23 pm
Location: United Kingdom

Postby Weaver » Thu Aug 05, 2004 5:16 pm

gorbachev wrote:better yet go here and see an example for yourself. The tag used in that example is
Code: Select all
<body background="twatbg.png" bgproperties="Fixed">


See what the W3C Validator has to say about your use of bgproperties (and a few other things).

-Weaver
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

PreviousNext

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 3 guests

cron
cron