Desain Web 03 HTML Css
Desain Web 03 HTML Css
Aryo Pinandito
HTML
!! Hypertext Markup Language !! Bare Minimum of HTML Structure! !! "#$%&'()*!+,-./!
"+,-./! !!"+012/! !!!",3,.0/$456-07,!'3,.0"8,3,.0/! !"8+012/! !"942:/! !!!";/<0,=>!?45@!,+0!9?4A>0?!A3,+!B'C<D"8;/! !"8942:/! "8+,-./!
More HTML
!! Document type:
!! HTML5
"#$%&'()*!+,-./! !
!! XHTML
"#$%&'()*!+,-.!)EF<G&!HI88JK&88$'$!LB'C<!MNO! '?17>3,3471.88*PH! H+,,;Q88AAANAKN4?R8'S8T+,-.M8$'$8T+,-.MI ,?17>3,3471.N2,2H/!
"-0,1!+,,;I0Z63[UH&47,07,I ':;0H547,07,UH,0T,8+,-.\!5+1?>0,UE']IYH/!
!
!! Form
"X4?-/!
!! Form Component
"37;6,/`!">0.05,/`! ",0T,1?01/!
!! Paragraph
";/!
!! Link/Anchor
"1/!
!! List
"4./`!"6./`!".3/!
!! Layer (Box)
"23[/!
!! Image
"3-R/!
!! Formatting
">,?47R/`!"0-/`!">69/!
!! Horizontal Line
"+?/!
!! Line Break
"9?/!
Inline Elements
!! "-1?@/ - to indicate content
that is marked in some fashion that is a time or date
a page
!! "20,13.>/
!! "21,1R?32/ !! "-076/
!! an old tag brought back and given new life allowing you to
create a menu system on your Web pages
!! "54--172/
space in JavaScript on your Web pages. It can let you add images or graphs to tool tips or just create dynamic graphs on your Web pages, built on the fly. this simple tag. this simple tag.
!! "[3204/ - add video to your Web pages with !! "16234/ - add sound to your Web pages with
HTML5
<header>
<div id=footer>
<footer>
ems !! percentage - width values relative the containing boxs content region
Content
20
Padding Content
With margin, border and padding properties, each of the 4 sides can be specified independently
21
glance. But each has its own effect on content, particularly on any backgrounds assigned to block and div elements.
Margin Padding
Content
SM5312 week 9: CSS Layout
22
the border !! Margin properties can have negative values in order to deliberately overlap content !! Margin properties will affect the position of background elements (graphics and/or colours) in relation to the edges of the containing block element !! Margin properties can be defined independently on top, right, bottom and left, or all-at-once using CSS shorthand
23
the border; i.e between the border and the content itself !! Padding properties cannot have negative values !! Padding properties do not affect the position of background elements (graphics and/or colours) in the containing block element; only the position of content. !! Padding properties can be defined independently on top, right, bottom and left, or all-at-once using CSS shorthand
24
collapse to form a single margin !! The height of this combined margin will be equal the height of the larger of the 2 margins !! Margin collapse applies when: !! 2 or more block elements are stacked one above the
other, !! or when one block element is contained within another block element
25
Margin-bottom: 30px
26
* Note: only applies if there are no borders or padding separating the margins.
27
10
28
0 20
Content Area 12 10 5
30 6
29
5 20
Content Area 20
20 5
30
Content Area 20 20
10 0
31
!! A useful value to
remember is auto: !! #container { padding: 10px 20px; margin: 0px auto; } !! Usually applied to the left & right areas of the margin property, auto is useful for centering a block container element in the browser window
auto
Content Area 20 20
auto
10 0
32
Borders
!! Borders can be applied to any block element !! Borders always come outside the padding area, but
inside the margin area. !! Border properties cannot have negative values !! If a border is not specified, the default is no-border (i.e. no border appears and no space between any margin and padding is allocated for a border) !! Border properties can be defined independently on top, right, bottom and left, or all-at-once using CSS shorthand
33
Borders
!! The core border properties are:
!! Width: absolute (px, in, cm, or thin, medium,
thick), or relative (ems) !! Style: dotted, dashed, solid, double, groove, ridge, inset, outset, hidden, etc !! Color: blue, red, #FF9900, etc
34
elements are stacked, one above the other, so that theyre read from top to bottom. !! In CSS, this is said to be the normal flow.
!! (Note that CSS boxes for inline
elements are placed next to each other, within boxes for block elements, and will normally wrap according to the width of the containing block.)
But
35
!! we can position
block element boxes side-by-side in CSS using floats. !! Setting the float property to left or right causes a box to be taken out of its position in the normal ow and moved as far left or right as possible."
block
36
Float Values
text text text text text text text text text text text text text text text text text text text inline text text text text text text text text text text text text text text text text text text text text text text text text inline text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text inline text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
block
37
block
block
38
CSS Positioning
39
Box 1
Box 2
Box 3
Containing box
40
The result is the box is offset 20px from its original position in the normal flow. Box 2 may overlap other boxes in the flow, but other boxes still recognise its original position in the flow.
top: 20px Left: 20px
Box 1
Box 3
Containing box
41
normal flow, and positioned in relation to its nearest positioned ancestor (i.e. its containing box). !! If there is no ancestor box, it will be positioned in relation to the initial containing block, usually the browser window.
top: 20px
Left: 20px
Box 1
Box 3
42
initial position inside the containing block, but other boxes within the block (and still within the normal flow) act as if the box wasnt there.
top: 20px
Left: 20px
Box 1
Box 3
43
Positioning !! Allows the creation of floating elements that are always fixed in the same position in the browser window, while the rest of the content scrolls as normal !! (rather like the effect of fixed background attachments) !! PROBLEM: fixed positioning is not supported in IE5 and IE6(!), but can be made to work with javascript for those browsers
44
!! Summary:
normal flow and floats them left or right edges of the containing block !! Relative Positioning is relative to the elements initial position in the normal flow. !! Absolute Positioning is relative to the nearest positioned ancestor, or (if one doesnt exist) the initial container block (usually the browser window) !! Fixed Positioning is fixed in one position relative to the browser window only does not scroll with content (Not supported in IE5, IE6)
45
property any block element (including divs) to place a background image behind other elements. !! Background images can be !! small images that repeat horizontally or vertically to
fill a flexible background space, or !! one single image that fills a space of fixed size.
46
containing box, and the rest of the page !! But they can also be fixed, staying in the same position in the layout, while the rest of the content scrolls. !! #sidebar { float: right; width: 300px; margin-left: 25px; background-image: url(images/harbour.jpg); background-attachment: fixed; }
47
visually define a page, and separate content into a deliberate visual hierarchy. !! The ability to to repeat images in a background box, and reuse the SAME images across a number of boxes, means we can make very efficient use of images. !! Wherever possible, background images should be used in conjunction with background colours.
48
popular. Unfortunately, the current version of CSS does not have any properties that can define a corner radius (CSS 3 will). !! However, simple rounded corner boxes are very easy to create in CSS 2 with a couple of background images.
49
50
boxes are a little more complicated... !! You to break a large box into 4 images, then use CSS to have the right side pieces slide over the larger (fixed-position) left pieces. !! CSS code tutorial
boxshadedbottomleft.gif boxshadedbottomright.gif
51
52
window: !! Set the body to center !! Create a container div (fixed or relative width), with left
and right margins set to auto
53
!! Like this:
!! Set the body to center !! Create a container div (fixed or relative width), with..
!! Position: absolute; !! top: 50%; !! left: 50%; !! margin-top: -300px; !! margin-left: -400px;
54
applied to any simple XHTML block element (p, h1, etc.) !! However, we often use specific <div> elements within the XHTML, each identified with an ID or class name !! We then apply width, float, margin, padding and border properties to those divs in CSS. !! This gives us more options to create and control a range of layout elements, on top of core content elements.
55
!! <div id=sidebar>
!! <div class=sidebar>
<p> blah, blah, blah, blah, blah, blah. </p> </div> #sidebar { float: right; width: 300px; margin-left: 25px; }
!! In the CSS: !!
!! In the CSS: !!
.sidebar { float: right; width: 300px; margin-left: 25px; }
56
And Finally
!! CSS inspiration:
!! www.csszengarden.com
!! Wireframing Tools
http://pencil.evolus.vn
57
Questions?