Wt-Class 4
Wt-Class 4
Background-position
Places the image on the page
Keywords top, bottom, center, left and right are used
individually or in combination for vertical and
horizontal positioning.
Backgrounds
Example: background-position: 50% 30px;
Position the image as horizontally centered and 30
pixels from the top
Background-repeat
Controls background image tiling, which places
multiple copies of the image next to each other to fill
the background
Example: background-repeat: no-repeat;
no-repeat: to display only one copy of the background
image
repeat (the default): tile the image vertically and
horizontally
Backgrounds
repeat-x: To tile the image only horizontally
repeat-y: To tile the image only vertically
background-attachment
Example: background-attachment: fixed
Fixed: Fixes the image in the position specified by
background-position
scroll (default): Moves the image as the user scrolls
through the document.
Backgrounds
text-indent
To indent the first line of text in the element by a
specified amount,
em is scalable
unit that is
equal to
current font
size.
Ex: If current
font size is 12
pt then 1 em=
12 pt
Backgrounds
Output of background-repeat: repeat
2<HTML>
3
1. position property
4<!-- Fig 9.6: positioning.html -->
1.1 absolute
5<!-- Absolute positioning of elements --> positioning
6 1.2 z-index
7<HEAD>
8<TITLE>Absolute Positioning</TITLE>
9</HEAD>
10
11<BODY>
12
19
20</BODY>
21</HTML>
Positioning elements with CSS
Positioning Elements (II)
CSS position property (cont.)
Relative positioning
Browser lays out the element on the page
Then offsets the element by specified top, bottom, left or
right values
Keeps elements in the general flow of elements on the page