Formatting Layout With Css
Formatting Layout With Css
WITH CSS
BOX MODEL
To understand layout using CSS, you have to use the box model where each element
on a page exists in its own box wherein each box aligns with other boxes on the page.
The box model consists of margins, borders, padding and the actual content.
CSS will allow you to control the dimension of the box using the height and the width
properties. You can define the boxes for your content using the block-level tags. Some
block-level tags are <p>, <h1>, <table>, and the generic level tag <div> which is
placed around others tags to organize the contents’ layout.
Heading
Text Video
Default position
Absolute Fixed
Top: 100px; Top: 100px;
Relative Left: 100px Left: 300px
Top: 100px;
Left: 100px
position: static The default or normal position of an object if one would not
specify a position.
position: relative The position of the box relative to where the default or normal
position of an object.
position: absolute The position is defined by the values where the position of the
element would be from the specified reference point (from left,
from the top)
position: fixed The same as the absolute position, the only difference is that the
object is “fixed” and will not move with the scroll action of the
page.
div#left {
width: 200px;
height: 600px;
position:absolute;
top: 120px;
left: 20px; }
div#right {
width: 400px;
height: 700px;
position:absolute;
top: 125px;
left: 25px; }
float:none
Email is the transmission of electronic messages over the internet. Email is the transmission of
electronic messages over the internet. Email is the transmission of electronic messages over the
internet. Email is the transmission of electronic messages over the internet.
div#left {
width: 300px;
float: left; }
div#right {
width: 300px; }
The background property is a shorthand notation for all the other properties
(background-color, background-image, background-repeat, background-attachment
and background-position). It can be used to style the background using only a single
property
05.30 2022
16 Sarah Marie Joy A. Dela Vega, MIT
ADDING BACKGROUND IMAGE
Background Repeat
05.30 2022
17 Sarah Marie Joy A. Dela Vega, MIT
ADDING BACKGROUND IMAGE
Background Repeat
Image
repeated on
the left side of
the page
05.30 2022
18 Sarah Marie Joy A. Dela Vega, MIT
You can control how an image background should repeat in order to cover the whole
area of a web page or the desired area.
Margin