HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
freeze background
Goto page Previous  1, 2, 3
Post new topic   Reply to topic    HTML Help Forum Index -> General HTML
View previous topic :: View next topic  
Author Message
StPatty33



Joined: 19 Apr 2009
Posts: 8

PostPosted: Sun Apr 19, 2009 4:54 pm     Reply with quote

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: 2309

PostPosted: Sun Apr 19, 2009 6:44 pm     Reply with quote

Code:
<body style="background: #000 url(imagepath.gif) fixed no-repeat bottom center; vertical-align: top;">
StPatty33



Joined: 19 Apr 2009
Posts: 8

PostPosted: Sun Apr 19, 2009 7:28 pm     Reply with quote

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: 2309

PostPosted: Sun Apr 19, 2009 7:32 pm     Reply with quote

Code:
<body style="background: #000 url(imagepath.gif) fixed no-repeat top center; vertical-align: top;">
StPatty33



Joined: 19 Apr 2009
Posts: 8

PostPosted: Sun Apr 19, 2009 8:10 pm     Reply with quote

You are AWESOME! Thanks a ton!
piperk



Joined: 07 Oct 2009
Posts: 2

PostPosted: Wed Oct 07, 2009 7:49 am     Reply with quote

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: 2309

PostPosted: Wed Oct 07, 2009 1:44 pm     Reply with quote

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

PostPosted: Thu Oct 08, 2009 12:57 pm     Reply with quote

thanks for the code... but i tried it, and now my image won't even show up...
sticks464



Joined: 31 Dec 2006
Posts: 2309

PostPosted: Thu Oct 08, 2009 1:17 pm     Reply with quote

Your gonna have to post all the code that your using so I know if there are other elements that may interfere.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> General HTML All times are GMT - 8 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial