09.06.2015 Views

learn_HTML

learn_HTML

learn_HTML

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Relative Positioning Article<br />

position:relative<br />

<strong>HTML</strong><br />

chapter-15/position-relative.html<br />

<br />

The Evolution of the Bicycle<br />

In 1817 Baron von Drais invented a walking<br />

machine that would help him get around the<br />

royal gardens faster...<br />

<br />

CSS<br />

p.example {<br />

position: relative;<br />

top: 10px;<br />

left: 100px;}<br />

Result<br />

Relative positioning moves an<br />

element in relation to where it<br />

would have been in normal flow.<br />

For example, you can move it 10<br />

pixels lower than it would have<br />

been in normal flow or 20% to<br />

the right.<br />

You can indicate that an element<br />

should be relatively positioned<br />

using the position property<br />

with a value of relative.<br />

You then use the offset<br />

properties (top or bottom and<br />

left or right) to indicate how<br />

far to move the element from<br />

where it would have been in<br />

normal flow.<br />

To move the box up or down,<br />

you can use either the top or<br />

bottom properties.<br />

To move the box horizontally,<br />

you can use either the left or<br />

right properties.<br />

The values of the box offset<br />

properties are usually given in<br />

pixels, percentages or ems.<br />

LAYOUT<br />

366

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!