H I O X INDIA
FREE CSS Tutorial
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Templates 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)
Español Français 中文 Deutsch Portuguese Japanese தமிழ்
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

CSS Topics
Introduction
Types
Background Properties
Text Properties
Font Properties
BOX Properties
Border Properties
Margin Properties
Padding Properties
Special Topics
Ask Your Doubts
More about CSS
Feedback





CSS Background Attachment


Topic

I want a fixed image. The image should scroll with the page and always be seen at the top, how to do it?
I want the background image in the html page to be in the same position?



Explanation

Property: Background Attachment

Usage:
background-attachment: scroll;
background-attachment: fixed;

Definition:
This tag sets the property of how the background image should behave. Whether it should scroll with the page or be static.
It takes the following values.
a)scroll : The image will scroll with the page
b)fixed : The image will not scroll with the page. It will be static. The content will be moving but not the image

Examples:
<body style="background-image: url('test3.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: scroll;"> color name <br><br><br></body>

<body style="background-image: url('test3.jpg'); background-repeat: no-repeat; background-position: center; background-attachment: fixed;"> color name <br><br><br></body>


Results:
with scroll:
It the default behaviour.

with fixed:
The image shown in this page is an example of fixed.

Thus we can get the non movable / immovable background image.






A Note
CSS - Cascading Style Sheets can be used along with html tags as explained in this site. This simple CSS will help you to create much elegant and neat html web pages. This does not need any additional softwares or codings. All web browser are capable of handing CSS codes.

Note 2: If required you can using <span> instead of <div> tags. div tag will start and end on new lines. span will not exceed the tag area.


privacy policy     license     sitemap
© 2004-2010 HIOX INDIA