TypechoJoeTheme

Dcr163的博客

统计

最新文章

2017-03-09

CSS3选择器 :enabled选择器

CSS3选择器 :enabled选择器
在Web的表单中,有些表单元素有可用(“:enabled”)和不可用(“:disabled”)状态,比如输入框,密码框,复选框等。在默认情况之下,这些表单元素都处在可用状态。那么我们可以通过伪选择器“:enabled”对这些表单元素设置样式。例如:可用输入框设置一个#f36颜色的边框以及5px的阴影色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>属性选择器</title> <style>     input[type='text']:enabled{         border:1px solid #f36;        &n...
2017-03-09

日志

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

CSS3 only-of-type选择器

CSS3 only-of-type选择器
“:only-of-type”选择器用来选择一个元素是它的父元素的唯一一个相同类型的子元素。这样说或许不太好理解,换一种说法。“:only-of-type”是表示一个元素他有很多个子元素,而其中只有一种类型的子元素是唯一的,使用“:only-of-type”选择器就可以选中这个元素中的唯一一个类型子元素。例如:将仅有一个P元素的背景修改为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>属性选择器</title> <style>     .wrapper >p:only-of-type{         background:orange;     } </style>...
2017-03-09

日志

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

CSS3 only-child选择器

CSS3 only-child选择器
“:only-child”选择器选择的是父元素中只有一个子元素,而且只有唯一的一个子元素。也就是说,匹配的元素的父元素中仅有一个子元素,而且是一个唯一的子元素。例如:通过“:only-child”选择器,改变只有一个列表项的背景色为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>属性选择器</title> <link href="style.css" rel="stylesheet" type="text/css"> <style>     li:only-child{         background:orange;  ...
2017-03-09

日志

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

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

CSS3 nth-last-of-type(n)选择器
    “:nth-last-of-type(n)”选择器和“:nth-of-type(n)”选择器是一样的,选择父元素中指定的某种子元素类型,但它的起始方向是从最后一个子元素开始,而且它的使用方法类似于“:nth-last-child(n)”选择器一样。例如:将容器“div.wrapper”中倒数第五个Div元素背景设置为橙色。<!DOCTYPE html> <html> <head>  <meta charset="utf-8"> <title>nth-last-of-type(n)</title> <style>     .wrapper>div:nth-last-of-type(5){         background:orange;   ...
2017-03-09

日志

860 阅读
0 评论
2017年03月09日
860 阅读
0 评论
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

日志

836 阅读
0 评论
2017年03月09日
836 阅读
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

日志

835 阅读
0 评论
2017年03月09日
835 阅读
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

日志

838 阅读
0 评论
2017年03月09日
838 阅读
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

日志

898 阅读
0 评论
2017年03月09日
898 阅读
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

日志

826 阅读
0 评论
2017年03月09日
826 阅读
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

日志

875 阅读
0 评论
2017年03月09日
875 阅读
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

标签云