HTML and CSS basis
- classes 和 IDs 的不同
- class 选择器用于描述一组元素的样式,class 选择器有别于id选择器,class可以在多个元素中使用。
- HTML 元素 elements
- 从开始标签(start tag)到结束标签(end tag)的所有代码。
- demo:
<title>peculiarly</title>
- What are tags?
- The basic structure of an HTML document includes tags, which surround content and apply meaning to it.
- demo: opening tag
<head>
and closing tag</head>
- What are forms?
<form>
标签用于创建供用户输入的 HTML 表单。
- What is a div?
<div>
可定义文档中的分区或节(division/section)。
- What is the difference between "pixels" and "ems"?
- px像素(Pixel),相对长度单位。px 是相对于显示器屏幕分辨率而言的。
- IE无法调整那些使用 px 作为单位的字体大小;
- em 是相对长度单位,相对于当前对象内文本的字体尺寸。如当前对行内文本的字体尺寸未被人为设置,则相对于浏览器的默认字体尺寸。
- em 的值并不是固定的;
- em 会继承父级元素的字体大小。
- px像素(Pixel),相对长度单位。px 是相对于显示器屏幕分辨率而言的。
- CSS 继承
- inherit
- demo:
div{color: red;} .extra div{color: inderit;}
- 移动页面元素的两种 CSS 属性
- float
- position
- CSS 插入样式表的三种方法
- 外部样式表(External style sheet)
- demo:
<head> <link rel="stylesheet" type="text/css" href="style.css"> </head>
- 内部样式表(Internal style sheet)
- demo:
<head> <style> p { color: blue; margin-right: 20px; } </style> </head>
内联样式(Inline style)
- deom:
<p style="color: blue; margin-right: 20px;">A paragraph.</p>
- 外部样式表(External style sheet)