目录
1、CSS选择器
基本选择器
层次选择器
锚点伪类选择器
a:link {color:} /* 未访问的链接 */
a:visited {color:} /* 已访问的链接 */
a:hover {color:} /* 鼠标划过链接 */
a:active {color:} /* 已选中的链接 */
/*
元素:hover 表示聚焦后改变自己
元素:hover 元素 表示聚焦后改变其子元素
元素:hover + 元素 表示聚焦后改变其指定的“亲兄弟”(条件是该兄弟元素与其相邻)元素
元素:hover ~ 元素 表示聚焦后改变其指定的兄弟元素,两个元素相不相邻都行。
*/
属性选择器
结构伪类选择器
2、<link>标签常用场景
<link rel="stylesheet" href="https://example.com/styles.css">
//链接到一个CSS层叠样式表
<link rel="canonical" href="URL.html">
//SEO优化:重定向
<link rel="shortlink" href="https://example.com/?p=42">
//之前用于包含icon的链接(已被废弃不再使用)
<link rel="amphtml" href="https://example.com/path/to/amp-version.html">
//链接到当前文档的一个 AMP HTML 版本
<link rel="manifest" href="manifest.json">
//链接到一个指定Web应用程序“安装”证书的JSON文件
<link rel="author" href="humans.txt">
//链接到文档的作者
<link rel="license" href="copyright.html">
//指向一个适用于链接内容的版权申明
<link rel="alternate" href="https://es.example.com/" hreflang="es">
//给出可能的你的另一种语言的文档位置参考
<link rel="me" href="https://google.com/profiles/thenextweb" type="text/html">
<link rel="me" href="mailto:599729022@qq.com">
<link rel="me" href="sms:+599729022">
//提供作者或其他的信息
<link rel="archives" href="https://example.com/archives/">
//链接到一个描述历史记录、文档或其他具有历史意义的材料的集合的文档
<link rel="index" href="https://example.com/">
//链接到层次结构中的顶级资源
<link rel="self" type="application/atom+xml" href="https://example.com/atomFeed.php?page=3">
//给出一个自我参考,当文档有多个可能的参考时非常有用
<link rel="first" href="https://example.com/atomFeed.php">
<link rel="next" href="https://example.com/atomFeed.php?page=4">
<link rel="prev" href="https://example.com/atomFeed.php?page=2">
<link rel="last" href="https://example.com/atomFeed.php?page=147">
//分别是在一系列文件中的第一个、下一个、上一个和最后一个
<link rel="EditURI" href="https://example.com/xmlrpc.php?rsd" type="application/rsd+xml" title="RSD">
//当使用第三方服务来维护 blog 时使用
<link rel="pingback" href="https://example.com/xmlrpc.php">
//当另一个 WordPress 博客链接到你的 WordPress 博客或文章时形成一个自动化的评论
<link rel="webmention" href="https://example.com/webmention">
//当你在自己的页面上链接到一个URL时通知它
<link rel="import" href="/path/to/component.html">
//加载一个外部的HTML文件到当前HTML文件中
<link rel="search" href="/open-search.xml" type="application/opensearchdescription+xml" title="Search Title">
//打开搜索
<link rel="alternate" href="https://feeds.feedburner.com/example" type="application/rss+xml" title="RSS">
<link rel="alternate" href="https://example.com/feed.atom" type="application/atom+xml" title="Atom 0.3">
//Feeds
<link rel="dns-prefetch" href="//example.com/">
<link rel="preconnect" href="https://www.example.com/">
<link rel="prefetch" href="https://www.example.com/">
<link rel="prerender" href="https://example.com/">
<link rel="preload" href="image.png" as="image">
//预取、预载、预浏览
<link rel="icon" href="favicon.ico" type="image/x-icon" />
//网页加入图标
<link rel="Bookmark" href="favicon.ico">
//收藏夹中显示的图标
<link rel="canonical" href="http://example.com/article.html">
//用于该文章的样式
<link rel="mask-icon" href="path/to/icon.svg" color="red">
//固定网站(Apple Safari浏览器)
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/APP_ID">
//禁用翻译提示(Google Chrome浏览器)
<link rel="manifest" href="manifest.json">
//链接到一个 manifest 并定义 manifest 的源数据
//manifest.json 中的例子也可以通过以下链接找到(Google Chrome Mobile 针对 Android)
<link rel="icon" sizes="192x192" href="highres-icon.png">
//主屏幕图标(Google Chrome Mobile 针对 Android)
3、边距与table的border-collapse
/*
语法:
border-collapse : separate | collapse
取值:
separate : 默认值。边框独立(标准HTML)
collapse : 相邻边被合并
当border-collapse设置为collapse时,表格自身的border与cellspacing属性便没有作用了。
border-collapse
*/
/*
内边距
padding
padding-top
padding-right
padding-bottom
padding-left
内边距是元素的内容与边框(border)之间的距离
padding:
如果 padding 属性缺失 bottom、left; bottom 会参考 top, left 会参考
外边距
margin
margin-top
margin-right
margin-bottom
margin-left
外边距是元素的边框外的距离,用来设置两个元素之间的距离间隔,也用来实现元素的居中
marign:0 auto;
但需要一个条件,那就是该元素的上级一定要设置text-align:center内容居中属性样式。
*/