TypechoJoeTheme

Dcr163的博客

统计
搜索到 317 篇与 日志 的结果
2017-03-09

CSS3 last-of-type选择器

CSS3 last-of-type选择器
“:last-of-type”选择器和“:first-of-type”选择器功能是一样的,不同的是他选择是父元素下的某个类型的最后一个子元素。例如:将容器“div.wrapper”中最后一个Div元素背景设置为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>属性选择器</title> <style>     .wrapper > div:last-of-type{       background: orange;     } </style> </head>  <body> <div class="w...
2017-03-09

日志

704 阅读
0 评论
2017年03月09日
704 阅读
0 评论
2017-03-09

CSS3 nth-of-type(n)选择器

CSS3 nth-of-type(n)选择器
“:nth-of-type(n)”选择器和“:nth-child(n)”选择器非常类似,不同的是它只计算父元素中指定的某种类型的子元素。当某个元素中的子元素不单单是同一种类型的子元素时,使用“:nth-of-type(n)”选择器来定位于父元素中某种类型的子元素是非常方便和有用的。在“:nth-of-type(n)”选择器中的“n”和“:nth-child(n)”选择器中的“n”参数也一样,可以是具体的整数,也可以是表达式,还可以是关键词。例如:第1行、第7行及第13行,输入正确的代码,将容器“div.wrapper”中的偶数段落和奇数Div背景设置为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>属性选择器</title> <style>     .wrapper > div:nth-of-...
2017-03-09

日志

747 阅读
0 评论
2017年03月09日
747 阅读
0 评论
2017-03-09

CSS3 first-of-type选择器

CSS3 first-of-type选择器
“:first-of-type”选择器类似于“:first-child”选择器,不同之处就是指定了元素的类型,其主要用来定位一个父元素下的某个类型的第一个子元素。例如:将容器“div.wrapper”中的第一个div元素和P元素背景设置为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>:first-of-type</title> <style>     .wrapper {       border: 1px solid #ccc;       padding: 10px;       ...
2017-03-09

日志

708 阅读
0 评论
2017年03月09日
708 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—nth-last-child(n)

CSS3 结构性伪类选择器—nth-last-child(n)
“:nth-last-child(n)”选择器和前面的“:nth-child(n)”选择器非常的相似,只是这里多了一个“last”,所起的作用和“:nth-child(n)”选择器有所区别,从某父元素的最后一个子元素开始计算,来选择特定的元素。例如:修改列表倒数第五项的背景色为橙色。    <!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构性伪类选择器—nth-last-child(n)</title> <style>     ol>li:nth-last-child(5){         background:red;       ...
2017-03-09

日志

769 阅读
0 评论
2017年03月09日
769 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—nth-child(n)

CSS3 结构性伪类选择器—nth-child(n)
“:nth-child(n)”选择器用来定位某个父元素的一个或多个特定的子元素。其中“n”是其参数,而且可以是整数值(1,2,3,4),也可以是表达式(2n+1、-n+5)和关键词(odd、even),但参数n的起始值始终是1,而不是0。也就是说,参数n的值为0时,选择器将选择不到任何匹配的元素。经验与技巧:当“:nth-child(n)”选择器中的n为一个表达式时,其中n是从0开始计算,当表达式的值为0或小于0的时候,不选择任何匹配的元素。如下表所示:例如:让奇数行背景色变成绿色,偶数行变橙色。    <!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构性伪类选择器—nth-child(n)</title> <style>     ol>li:nth-child(2n+1)...
2017-03-09

日志

699 阅读
0 评论
2017年03月09日
699 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—last-child

CSS3 结构性伪类选择器—last-child
“:last-child”选择器与“:first-child”选择器作用类似,不同的是“:last-child”选择器选择的是元素的最后一个子元素例如:在CSS编辑器的第十四行输入正确的代码,删除列表中最后一个列表项的底部边框,为第一个li添加红色底框。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构伪类选择器——last-child</title> <style>     ul {       border: 1px solid #ccc;       list-style: none outside none;  ...
2017-03-09

日志

750 阅读
0 评论
2017年03月09日
750 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—first-child

CSS3 结构性伪类选择器—first-child
“:first-child”选择器表示的是选择父元素的第一个子元素的元素E。简单点理解就是选择元素中的第一个子元素,记住是子元素,而不是后代元素例如:将无序列表的第一个项目符号和内容设置为红色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构性伪类选择器—first-child</title> <style>     ul>li:first-child,ul>li:first-child a{         color:red;     }      </style> </head>  <...
2017-03-09

日志

755 阅读
0 评论
2017年03月09日
755 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—target

CSS3 结构性伪类选择器—target
:target选择器称为目标选择器,用来匹配文档(页面)的url的某个标志符的目标元素。我们先来上个例子,然后再做分析。示例展示点击链接显示隐藏的段落。HTML代码:<h2><a href="#brand">Brand</a></h2> <div class="menuSection" id="brand">     content for Brand </div>CSS代码:.menuSection{   display: none; }:target{/*这里的:target就是指id="brand"的div对象*/   display:block; }演示结果:分析:1、具体来说,触发元素的URL中的标志符通常会包含一个#号,后面带有一个标志符名称,上面代码中是:#bran...
2017-03-09

日志

746 阅读
0 评论
2017年03月09日
746 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—empty

CSS3 结构性伪类选择器—empty
:empty选择器表示的就是空。用来选择没有任何内容的元素,这里没有内容指的是一点内容都没有,哪怕是一个空格。例如:给下面div里内容为空的加上边框<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构性伪类选择器—empty</title> <style>     div{         width:250px;         height:20px;     }     div:empty{        ...
2017-03-09

日志

710 阅读
0 评论
2017年03月09日
710 阅读
0 评论
2017-03-09

CSS3 结构性伪类选择器—not

CSS3 结构性伪类选择器—not
:not选择器称为否定选择器,和jQuery中的:not选择器一模一样,可以选择除某个元素之外的所有元素。例如:在CSS编辑器的第五行输入代码,除页脚”div#page”之外的所有div设置橙色背景色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>结构性伪类选择器—not</title> <style>     div{         width:100px;         height:100px;     }     div:not([id='page']...
2017-03-09

日志

743 阅读
0 评论
2017年03月09日
743 阅读
0 评论

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. https://www.triptipedia.com/user/phmapaladnet
    2025-05-08
  2. https://Sites.google.com/view/vavada-online-casino
    2025-04-12
  3. https://x.com/jeetbuzzcom
    2025-04-07
  4. prozone.cc alternative
    2025-03-19
  5. urgent delivery
    2025-03-16

标签云