 |
HTML Help Please Search for the answer to your question before asking it! Thanks.
|
| View previous topic :: View next topic |
| Author |
Message |
StPatty33
Joined: 19 Apr 2009
Posts: 8
|
| Posted: Sun Apr 19, 2009 4:54 pm |
|
|
Hello!
I stumbled accross this in my effort to center a background image left-to-right but have it vertically aligned at the top. This is the code that's working for me except for the top-aligned portion:
Code: <body style="background: #000 url(imagepath.gif) no-repeat fixed">
Can anyone help me figure out how to keep it centered left-to-right but align with the top? Thanks!! |
|
|
sticks464
Joined: 31 Dec 2006
Posts: 2308
|
| Posted: Sun Apr 19, 2009 6:44 pm |
|
|
| Code: <body style="background: #000 url(imagepath.gif) fixed no-repeat bottom center; vertical-align: top;"> |
|
|
StPatty33
Joined: 19 Apr 2009
Posts: 8
|
| Posted: Sun Apr 19, 2009 7:28 pm |
|
|
sticks464 wrote: Code: <body style="background: #000 url(imagepath.gif) fixed no-repeat bottom center; vertical-align: top;">
I appreciate the effort! It's still centering from top to bottom rather than aligning at the top though. |
|
|
sticks464
Joined: 31 Dec 2006
Posts: 2308
|
| Posted: Sun Apr 19, 2009 7:32 pm |
|
|
| Code: <body style="background: #000 url(imagepath.gif) fixed no-repeat top center; vertical-align: top;"> |
|
|
StPatty33
Joined: 19 Apr 2009
Posts: 8
|
| Posted: Sun Apr 19, 2009 8:10 pm |
|
|
| You are AWESOME! Thanks a ton! |
|
|
piperk
Joined: 07 Oct 2009
Posts: 2
|
| Posted: Wed Oct 07, 2009 7:49 am |
|
|
I have a similar problem. I want my image centered on the page... vertically and horizontally. Right now, it is centered, but it is aligned with the top of the page. Can I put it in the middle? Here is the coding I used.
Code: background-image: url(image/background.gif);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
vertical-align: center |
|
|
sticks464
Joined: 31 Dec 2006
Posts: 2308
|
| Posted: Wed Oct 07, 2009 1:44 pm |
|
|
Code: background: url(image/background.gif) no-repeat fixed center center;
Will do it every time.
The code is css shorthand, reduces browser render time and code bloat. |
|
|
piperk
Joined: 07 Oct 2009
Posts: 2
|
| Posted: Thu Oct 08, 2009 12:57 pm |
|
|
| thanks for the code... but i tried it, and now my image won't even show up... |
|
|
sticks464
Joined: 31 Dec 2006
Posts: 2308
|
| Posted: Thu Oct 08, 2009 1:17 pm |
|
|
| Your gonna have to post all the code that your using so I know if there are other elements that may interfere. |
|
|
| |
|
|
|
Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group
|