<table>

  <thead>

    <tr>            // table row

      <th></th>    // table head

    </tr>

  </thead>

  <tbody>

    <tr>

      <td></td>    // table data

    </tr>

  </tbody>

</table>

<span></span>

  1. type attribute that should always be equal to "text/css"
  2. rel attribute that should always be equal to "stylesheet"
  3. href attribute that should point to the web address of your CSS file
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>

Many HTML elements support theborder property. This can be especially useful with tables.

There's also a very special selector you can use to apply CSS styling to every element on the page: the * selector. 

class           .
id #
Classes are useful when you have a bunch of elements that should all receive the same styling. Rather than applying the same rules to several selectors, you can simply apply the same class to all those HTML elements, then define the styling for that class in the CSS tab.
div > p { /* Some CSS */ }
This only grabs <p>s that are nesteddirectly inside of <div>s; it won't grab any paragraphs that are, say, nested inside lists that are in turn nested inside<div>s.
This allows you to take elements of different types and give them the same styling. IDs, on the other hand, are great for when you have exactly one element that should receive a certain kind of styling.
This allows you to apply style to a single instance of a selector, rather than allinstances.

pseudo-class selectors for links

a:hover {
color: #cc0000;
font-weight: bold;
text-decoration: none;
}

a:link{}

a:visited{}

p:first-child {
color: red;
}/*It's used to apply styling toonly the elements that are the first children of their parents.*/
p:nth-child(2) {
color: red;
}/*第二个孩子颜色为红色*/

body :first-child{
font-size: 50px;
}

body :nth-child(4){
font-size: 26px;
color:blue;
}


Make sure to leave a space betweenbody :nth-child. If you don't have a space it means "find the body tag that is an nth-child". If you have a space it means "find the nth-child of the bodytag".
 
display: inline-block; inline none block默认

none

另一个常用的display值是 none 。一些特殊元素的默认 display 值是它,例如 script。 display:none 通常被 JavaScript 用来在不删除元素的情况下隐藏或显示元素。

它和 visibility 属性不一样。把 display 设置成 none 不会保留元素本该显示的空间,但是 visibility: hidden; 还会保留。



border-radius: 100%;
position: relative; float: right; left; ??????clear: left; right; both; position
clear 属性规定元素的哪一侧不允许其他浮动元素。
left 在左侧不允许浮动元素。
both 在左右两侧均不允许浮动元素。
none 默认值。允许浮动元素出现在两侧。 position
position:absolute这个是绝对定位;
是相对于浏览器的定位。
比如:position:absolute;left:20px;top:80px; 这个容器始终位于距离浏览器左20px,距离浏览器上80px的这个位置。 position:relative是相对定位,是相对于前面的容器定位的。这个时候不能用top left在定位。应该用margin。 比如:<div class="1"></div><div class="2"></div> 当1固定了位置。1的样式float:left;width:100px; height:800px;
2的样式为float:left; position:relative;margin-left:20px;width:50px;
2的位置在1的右边,距离120px
position:absolute这个是绝对定位;它不会随着窗口大小变化,只是固定在一个特定的坐标轴上面;
position:relative 这是相对定位啊!和上面的相反,它可以随窗口大小变化。但大小仍然不会变。要是你设置成width:100%;height:100%;这样就会随着窗口变大变小。。。
块,比如:div、p、h1~h6、ul、li
内联,比如:span、a
他们最大区别在于 块 元素后面的其他东西会被换到下行,而内联元素后面的东西不会

文档流: 将窗体自上而下分成一行行, 并在每行中按从左至右的顺序排放元素,即为文档流. 每个非浮动块级元素都独占一行, 浮动元素则按规定浮在行的一端. 若当前行容不下, 则另起新行再浮动. 内联元素也不会独占一行. 几乎所有元素(包括块级,内联和列表元素)均可生成子行, 用于摆放子元素。

3、区别:

A:行内就是在一行内的元素,只能放在行内,块级元素,就是一个四方块,可以放在页面上任何地方。

B:说白了,行内元素就好像一个单词,块级元素就好像一个段落,如果不另加定义的话,它将独立一行出现。

http://blog.csdn.net/liushuwei0224/article/details/8533157

http://zh.learnlayout.com/toc.html

我们现在一样大小了!

</div>

<div class="fancy">

万岁!

</div>

既然没有比这更好的方法,一些CSS开发者想要页面上所有的元素都有如此表现。所以开发者们把以下CSS代码放在他们页面上:

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

这样可以确保所有的元素都会用这种更直观的方式排版。

内联元素(inline element)一般都是基于语义级(semantic)的基本元素。内联元素只能容纳文本或者其他内联元素,常见内联元素 “a”

块元素一般都从新行开始,它可以容纳内联元素和其他块元素。常见块元素是段落标签'P"。“form"这个块元素比较特殊,它只能用来容纳其他块元素。

<mete> 标签:提供页面的元信息(meta-information),比如页面关键字;

<script> 标签:因为Html页面是从上到下加载,不是加载完再一次性显示内容,而是一边加载一边展示内容。

把Script放在body的后面,类似于说明此Script里的代码要调用body里的元素。若放在Head标签里,运行到此script代码时,body里的元素还没有加载,会获取不到所需的元素信息。

内联样式 > 内部样式表 > 外部样式表

Id选择器 > class 类选择器 >元素选择器。



 

HTML&CSS学习笔记的更多相关文章

  1. CSS学习笔记

    CSS学习笔记 2016年12月15日整理 CSS基础 Chapter1 在console输入escape("宋体") ENTER 就会出现unicode编码 显示"%u ...

  2. HTML+CSS学习笔记 (7) - CSS样式基本知识

    HTML+CSS学习笔记 (7) - CSS样式基本知识 内联式css样式,直接写在现有的HTML标签中 CSS样式可以写在哪些地方呢?从CSS 样式代码插入的形式来看基本可以分为以下3种:内联式.嵌 ...

  3. HTML+CSS学习笔记 (6) - 开始学习CSS

    HTML+CSS学习笔记 (6) - 开始学习CSS 认识CSS样式 CSS全称为"层叠样式表 (Cascading Style Sheets)",它主要是用于定义HTML内容在浏 ...

  4. HTML+CSS学习笔记(5)- 与浏览者交互,表单标签

    HTML+CSS学习笔记(5)- 与浏览者交互,表单标签 1.使用表单标签,与用户交互 网站怎样与用户进行交互?答案是使用HTML表单(form).表单是可以把浏览者输入的数据传送到服务器端,这样服务 ...

  5. HTML+CSS学习笔记(4) - 认识标签(3)

    HTML+CSS学习笔记(4) - 认识标签(3) 1.使用<a>标签,链接到另一个页面 使用<a>标签可实现超链接,它在网页制作中可以说是无处不在,只要有链接的地方,就会有这 ...

  6. HTML+CSS学习笔记(3)- 认识标签(2)

    HTML+CSS学习笔记(3)- 认识标签(2) 1.使用ul,添加新闻信息列表 在浏览网页时,你会发现网页上有很多信息的列表,如新闻列表.图片列表, 这些列表就可以使用ul-li标签来完成.ul-l ...

  7. HTML+CSS学习笔记(2) - 认识标签(1)

    HTML+CSS学习笔记(2) - 认识标签(1) 1.语义化,让你的网页更好的被搜索引擎理解 标签的用途: 我们学习网页制作时,常常会听到一个词,语义化.那么什么叫做语义化呢,说的通俗点就是:明白每 ...

  8. HTML+CSS学习笔记(1) - Html介绍

    HTML+CSS学习笔记(1) - Html介绍 1.代码初体验,制作我的第一个网页 <!DOCTYPE HTML> <html> <head> <meta ...

  9. css学习笔记四

    广州天气变冷了,css学习笔记还是要总结. 总结: 1:几米页面静态页面主要是一列结构头部banner图,mainbody部分放文字内容和图书图片,底部是页面的版权信息 2:腾讯软件中心静态页面制作( ...

  10. CSS学习笔记:溢出文本省略(text-overflow)

    原文:CSS学习笔记:溢出文本省略(text-overflow) 在CSS3中,text-overflow属性的基本语法如下: clip:表示不显示省略文本,简单的裁切. ellipsis:表示对象文 ...

随机推荐

  1. android 插件合集

    1.增加编译速度:fastdex-plugin 2.gradle 版本网站http://services.gradle.org/distributions/

  2. Jquery 获取radio选中值

  3. IDA Pro使用技巧

    DA Pro基本简介 IDA加载完程序后,3个立即可见的窗口分别为IDA-View,Named,和消息输出窗口(output Window). IDA图形视图会有执行流,Yes箭头默认为绿色,No箭头 ...

  4. golang string int int64转换

    #string到int int,err:=strconv.Atoi(string) #string到int64 int64, err := strconv.ParseInt(string, 10, 6 ...

  5. python的安装和pycharm的安装

    下载地址   官网:https://www.python.org/downloads/release/python-372/ Window 平台安装 Python: Add python xx to ...

  6. [HAOI2018]奇怪的背包 (DP,数论)

    [HAOI2018]奇怪的背包 \(solution:\) 首先,这一道题目的描述很像完全背包,但它所说的背包总重量是在模P意义下的,所以肯定会用到数论.我们先分析一下,每一个物品可以放无数次,可以达 ...

  7. 解决:[DCC Fatal Error] **.dpk : E2202 Required package '***' not found

    //[DCC Fatal Error] **.dpk : E2202 Required package '***' not found 意思是:[DCC致命错误] *:e2202需包***没有发现 D ...

  8. js中获取时间new date()的用法和获取时间戳

    获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getF ...

  9. VIM for C++ 一键安装配置

    执行: wget https://raw.github.com/ma6174/vim/master/setup.sh -O ma6174_vim_setup.sh && bash ma ...

  10. 【C++】面试题目:从尾到头打印链表

    通过<剑指offer 名企面试官精讲典型编程题>看到一道讲解链表的题目. 题目:输入一个链表的头结点,从尾到头反过来打印出每个结点的值 链表定义如下: typedef struct _NO ...