Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CSS 基礎
Search
大澤木小鐵
October 30, 2012
Programming
11
920
CSS 基礎
教育訓練用
大澤木小鐵
October 30, 2012
Tweet
Share
More Decks by 大澤木小鐵
See All by 大澤木小鐵
Effective Unit Testing
jaceju
3
550
JSConf Asia 2014 Sessions
jaceju
4
390
What happens in Laravel 4 bootstraping
jaceju
9
550
Deal with Laravel assets by Bower & Gulp
jaceju
30
1.9k
Leaning MVC By Example
jaceju
0
350
ng-conf_2014
jaceju
2
970
The Power of JavaScript in JSConf.Asia 2013
jaceju
5
370
jQuery vs AngularJS, dochi?
jaceju
20
2.9k
Begining Composer
jaceju
24
5k
Other Decks in Programming
See All in Programming
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
7
430
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
Realtime API 入門
riofujimon
0
110
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
270
Golang と Erlang
taiyow
8
1.9k
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
150
Outline View in SwiftUI
1024jp
1
110
WEBエンジニア向けAI活用入門
sutetotanuki
0
300
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
What's in a price? How to price your products and services
michaelherold
243
12k
Intergalactic Javascript Robots from Outer Space
tanoku
268
27k
We Have a Design System, Now What?
morganepeng
50
7.2k
Designing Experiences People Love
moore
138
23k
Become a Pro
speakerdeck
PRO
24
5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
A Philosophy of Restraint
colly
203
16k
Transcript
Jace Ju @ Sina Taiwan 基礎 CSS
什麼是 CSS 1
.COM 時代 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="Bpadd"> <tr>
<td bgcolor="#C8DDF1" class="text13b"><a href="/itadm/ category.php?cat=93"><font color="#000000">CIO</font></a></td> </tr> <tr> <td class="text13"><font color="#666666">•</ font> <a href="/itadm/article.php?c=76963" title="2012-10-29"> 集團打造零售四合⼀一計畫 ⼀一年半內同時完成⼋八⼤大系統調整</a></td> </tr> <tr> <td class="text13"><font color="#666666">•</ font> <a href="/itadm/article.php?c=76880" title="2012-10-22">IT是台灣技術創新⽕火⾞車頭 從企業營運⾓角度評選新興科技 </a></td>
Cascading Styling Sheets 瀏覽器樣式 網⾴頁作者樣式 使⽤用者樣式
CSS 概念 1994 CSS 2.0 1998 CSS 2.1 2011 W3C
正式接⼿手 1997 History of CSS CSS 1.0 1996.12 CSS 3
CSS 能做些什麼 2
⽤用以視覺化的 HTML 標籤 <p> <font face="Arial" size="3" color="red"> Text </font>
</p>
CSS 樣式化 <p>Text</p> p { font-family: Arial; font-size: 3em; color:
red; }
選擇器 CSS 語法 p { font-size: 3em; color: red; }
用大括號來包含樣式 CSS 語法 p { font-size: 3em; color: red; }
屬性 CSS 語法 p { font-size: 3em; color: red; }
值 CSS 語法 p { font-size: 3em; color: red; }
分號後再加入下一組屬性 CSS 語法 p { font-size: 3em; color: red; }
CSS 檔案 p { font-family: Arial; font-size: 3em; color: red;
} <p>Text</p> <p>Text</p> <p>Text</p>
怎麼套⽤用 CSS 3
inline styling <p style="font-family: Arial; font-size: 3em; color: red;">Text</p>
Style Tag <style type="text/css"> p { font-family: Arial; font-size: 3em;
color: red; } </style>
Link Tag <head> <link rel="stylesheet" href="theme.css"> </head>
搭配 HTML 4
<p>Normal text</p> <p class="note">Some note</p> class
<p>Normal text</p> <p class="note">Some note</p> class p { font-family: Arial;
font-size: 3em; color: black; } p.note { color: red; } http://jsfiddle.net/hkvBC/
Bad class p.big-red { font-family: Arial; font-size: 3em; color: red;
}
Bad class p.big-red { font-family: Arial; font-size: 3em; color: blue;
}
Bad class p.note { font-family: Arial; font-size: 3em; color: blue;
}
<div id="header"> <h1>Title</h1> </div> id http://jsfiddle.net/hkvBC/
<div id="header"> <h1>Title</h1> </div> id #header { height: 80px; }
http://jsfiddle.net/hkvBC/
CSS 排版 5
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="Bpadd"> <tr> <td bgcolor="#C8DDF1"
class="text13b"><a href="/itadm/ category.php?cat=93"><font color="#000000">CIO</font></a></td> </tr> <tr> <td class="text13"><font color="#666666">•</ font> <a href="/itadm/article.php?c=76963" title="2012-10-29"> 集團打造零售四合⼀一計畫 ⼀一年半內同時完成⼋八⼤大系統調整</a></td> </tr> <tr> <td class="text13"><font color="#666666">•</ font> <a href="/itadm/article.php?c=76880" title="2012-10-22">IT是台灣技術創新⽕火⾞車頭 從企業營運⾓角度評選新興科技 </a></td> Table Layout
<body> <header id="header"><h1>...</h1></header> <div id="body" > <div id="wrapper" class="clearfix"> <section
id="maincol"><h1>...</h1></section> <aside id="aside"><p>...</p></aside> </div> </div> <footer id="footer"><h2>Footer</h2><p>...</p></footer> </body> CSS Layout
CSS Layout #header { position:relative; height:80px; background-color:#FFFFFF; width:100%; display:block; overflow:auto;
} #aside { width:240px; float:left; position:relative; } #main { background-color: #FFFFFF; position: relative; width:720px; float:right; } #footer { height:100px; background-color:#FFFFFF; clear:both; display:block; overflow:auto; }
IE must die! Problems ‧設計師必須學習 CSS 語法 ‧瀏覽器呈現不一致 ‧IE 舊版本不符合
Web 標準
CSS Reset ‧瀏覽器有預設樣式 ‧解法:將所有樣式去除 html, body, div, span, applet, object,
iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, ... { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } http://meyerweb.com/eric/tools/css/reset/
CSS3 簡介 6
‧外部字體 ‧方盒模型 ‧背景 ‧多欄排版 ‧2D 漸變 ‧3D 漸變 ‧媒體偵測 ‧進階選擇器
CSS3 Modules 其他還有很多... http://www.css3.info/modules/ http://www.w3schools.com/css3/
-moz- /* Firefox */ -webkit- /* Safari, Chrome */ -o-
/* Opera */ -ms- /* Internet Explorer */ Vendor Prefix http://css-snippets.com/browser-prefix/
.box { border: 1px solid #ccc; -webkit-border-radius: 2px; -moz-border-radius: 2px;
-o-border-radius: 2px; border-radius: 2px; } Vendor Prefix http://css-snippets.com/browser-prefix/
Graceful Degradation http://jonraasch.com/blog/graceful-degradation-with-css3 ⽀支援 CSS3 不⽀支援 CSS3
Examples 7
• CSS3 buttons • 3D CSS Cube • Image Gallery
• 秋⼭山澪 http://webdesignerwall.com/trends/47-amazing-css3-animation-demos
問題與討論