如何跳过第一个孩子? [英] How to skip first child?

查看:140
本文介绍了如何跳过第一个孩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<div id="main">    
  <p> one </p>    
  <p> two </p>
  <p> three </p>
  <p> four </p>
  <p> five </p>
<div>

我不想在第一个应用css < p& ; / p>

I don't want to apply css on first <p>One</p>

p {color:red}

我需要在的对面:first-child

推荐答案

使用否定伪类

p:not(:first-child) { color: red; }

浏览器支持

Browser support is very strong now, but alternatives include:

p { color: red; }
p:first-child { color: black; }

和:

* + p { color: red; }

这篇关于如何跳过第一个孩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆