Top Banner
Extra CSS
35

Website development process CSS Javascript.

Dec 31, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Website development process  CSS  Javascript.

Extra CSS

Page 2: Website development process  CSS  Javascript.

Website development process CSS Javascript

Content

Page 3: Website development process  CSS  Javascript.

Customer

Analyst

Designer

Web

developer

Tester

I want…I need …

Page design

Website

Website specification

Sitemap

Wireframe

Content

Website development process

Template

Page 4: Website development process  CSS  Javascript.

Total element width = width + left padding + right padding + left border + right border + left margin + right margin

Total element height = height + top padding + bottom padding + top border + bottom border + top margin + bottom margin

IE includes padding and border in the width, when the width property is set, unless a DOCTYPE is declared.

Box model

Page 5: Website development process  CSS  Javascript.

A fixed layout is a layout with a fixed width

Fixed layout

Pros : • Easy to create• Width are the same

in all browser• No need min-width,

max-widthCons : • Additional spaces in

high resolution• Scrollbars when in

low resolutionExamples : http://www.lebloe.comhttp://www.floridaflourish.com

Page 6: Website development process  CSS  Javascript.

Fluid (liquid) layout is a layout that adjust to the user’s screen resolution

Fluid layout

Pros : • More use friendly• No unused spaces• Eliminate horizontal

scrollbarCons : • May look awful in

some resolution• Image, video may

have multiple width• Additional space

while less content in large resolution

Page 7: Website development process  CSS  Javascript.

CSS float allows element to be pushed to left or right so that other elements will wrap on it

Ex : img{ float:left;} Float usually used for images and layout To turn off other elements to wrap around

float, use {clear:both} or clearfix (google it)

Floating element

Page 8: Website development process  CSS  Javascript.

Layout using float

Page 9: Website development process  CSS  Javascript.

Using {position} we can place an element anywhere on webpage◦ position : static;◦ position : fixed;◦ position : relative;◦ position : absolute;

Positioning element

Page 10: Website development process  CSS  Javascript.

Static position static — The default positioning of all

elements. Static elements remain in the normal page flow and do not move.

Page 11: Website development process  CSS  Javascript.

Fixed position fixed — Element will be taken out of the

normal flow of the page, and attach to viewable page edges

fixed element will stay visible even when the page is scrolled.

Internet Explorer 6 does not support fixed positioning without !DOCTYPE

Page 12: Website development process  CSS  Javascript.

Demo fixed element PositionFixed.html

Page 13: Website development process  CSS  Javascript.

Relative position relative — A relative element will be

positioned according to its static place holder

relative element will have a place holder to mark its original place

Page 14: Website development process  CSS  Javascript.

Demo relative element PositionRelative.html

Page 15: Website development process  CSS  Javascript.

Absolute position absolute — An absolute-positioned

element will be taken out of the normal flow of the page & placed according to its nearest relative-positioned parent.

By default, <body> will have position:relative;

Page 16: Website development process  CSS  Javascript.

Demo absolute position AbsolutePosition.html

Page 17: Website development process  CSS  Javascript.

Overlap element If 2 elements are overlapped when

displaying, z-index will be used to specify their orders

z-index can be positive or negative Higer z-index will be in front of others

Page 18: Website development process  CSS  Javascript.

Demo overlap PositionOverlap.html

Page 19: Website development process  CSS  Javascript.

A technique to replace text with image using CSS

<h1 class=“header"> Toosols online </h1>.header{

overflow:hidden;text-indent:-9999px;background:url(logo.gif) no-repeat;

}

Image replacement

Page 20: Website development process  CSS  Javascript.

Sliding door

Page 21: Website development process  CSS  Javascript.

Rounded box

Page 22: Website development process  CSS  Javascript.

IE6 and below has many CSS bugs

Some bugs : ◦ PNG transparency ◦ IE Box model◦ Double margin bug◦ No min/max width/height

Cross browser issue

Page 23: Website development process  CSS  Javascript.

Float left (right) element that has left (right) margin will have double margin

Demo : Fix :

◦ Add display:inline; to the floated element

Double margin bug

Page 24: Website development process  CSS  Javascript.

E6 ignores the min-height property and instead treats height as the minimum height

Demo : Fix : /*For IE6*/ #container {min-height:200px; height:200px;} /*For all other browsers*/ html>body #container { height:auto;}

Min Height

Page 25: Website development process  CSS  Javascript.

100% height doesn’t effect in IE6 Fix :

◦ Specify a fixed height of its parent element. ◦ Need element fill the full-length of your page, apply

height:100%; to both the html and body elements/*100% height of the parent element for IE6*/ #parent {height:500px;} #child {height:100%;} /*100% of the page length for IE6*/ html, body {height:100%;} #fullLength {height:100%;}

100% Height

Page 26: Website development process  CSS  Javascript.

Floated elements drop below their expected position when their total width exceeds the content’s width of its container.

Demo Fix :

◦ Wrap content in a fixed-width container large enough to accommodate the content, or remove the width from the static block.

Float Drops

Page 27: Website development process  CSS  Javascript.

Container will not wrap floated elements properly

Fix : ◦ Add width & overflow : hidden to its

container

Clear float

Page 28: Website development process  CSS  Javascript.

When text is next to a floated element. IE6 will add a 3px margin between the element and the text, even if none is specified

Fix : ◦ When in IE6, apply margin-left : -3px for text

3px text jog bug

Page 29: Website development process  CSS  Javascript.

http://blueprintcss.googlecode.com License: MIT Based on the idea of splitting the

width of apage into 24 columns (with 40px = 30px +10px margin each)

By default max-width 950px (24 * 40 -10)

No fluid layout possible (yet)

Introduce Blueprint

Page 30: Website development process  CSS  Javascript.

Ví dụ Style object example

Page 31: Website development process  CSS  Javascript.

Ví dụ

Page 32: Website development process  CSS  Javascript.

Thay đổi border, margin, paddingDOM Node properties

Page 33: Website development process  CSS  Javascript.

Thay đổi backgroundStyle background

Page 34: Website development process  CSS  Javascript.

Thay đổi fontStyle font

Page 35: Website development process  CSS  Javascript.

Objects Everything in Javascript is object includes

function Object is simple name-value pairs, as seen

in:◦ Dictionaries in Python◦ Hashes in Perl and Ruby◦ Hash tables in C and C++◦ HashMaps in Java◦ Associative arrays in PHP

Very common, versatile data structure Name part is a string; value can be anything