4lqedz 发表于 2024-6-30 06:38:46

css中“>”(大于号)、"~"(浪花号)、" "(空格)、","(逗号)、"+&q


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">对新手<span style="color: black;">来讲</span>,在布局中<span style="color: black;">一般</span>搞不清这些符号的用法,今天就来为<span style="color: black;">大众</span><span style="color: black;">仔细</span>讲解一下。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">1、&gt;(大于号) 子元素<span style="color: black;">选取</span>器 </h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">&gt;大于号的意思是 <span style="color: black;">选取</span>某元素后面的<span style="color: black;">第1</span>代子元素</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">案例</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">&lt;</span><span style="color: black;">style</span> <span style="color: black;">type</span><span style="color: black;">=</span><span style="color: black;">"text/css"</span><span style="color: black;">&gt;</span>
      <span style="color: black;">h1</span><span style="color: black;">&gt;</span><span style="color: black;">strong</span> <span style="color: black;">{</span>
      <span style="color: black;">color</span><span style="color: black;">:</span> <span style="color: black;">red</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">style</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>一代子元素<span style="color: black;">&lt;/</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>二代子元素<span style="color: black;">&lt;/</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;">
      <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic4.zhimg.com/v2-096068fee852feaa71d2f60e72a407cf_b.jpg" style="width: 50%; margin-bottom: 20px;"></div>
    </div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">2、~(<span style="color: black;">浪花</span>号)</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">~<span style="color: black;">浪花</span>号的意思是 <span style="color: black;">选择</span> 某个元素之后的所有相同元素</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.box~h2 这句<span style="color: black;">便是</span> <span style="color: black;">选择</span> .box 后面所有的 h2</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这个<span style="color: black;">选取</span>器 两种元素<span style="color: black;">必要</span><span style="color: black;">处在</span>同一个父元素内,被<span style="color: black;">选择</span>的元素不必直接紧随。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">&lt;</span><span style="color: black;">style</span> <span style="color: black;">type</span><span style="color: black;">=</span><span style="color: black;">"text/css"</span><span style="color: black;">&gt;</span>
      <span style="color: black;">.</span><span style="color: black;">box</span><span style="color: black;">~</span><span style="color: black;">h2</span><span style="color: black;">{</span>
      <span style="color: black;">bac<span style="color: black;">公斤</span>round</span><span style="color: black;">:</span> <span style="color: black;">aqua</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">style</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">div</span> <span style="color: black;">class</span><span style="color: black;">=</span><span style="color: black;">"box"</span><span style="color: black;">&gt;&lt;/</span><span style="color: black;">div</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>1<span style="color: black;">&lt;/</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">em</span><span style="color: black;">&gt;</span>2<span style="color: black;">&lt;/</span><span style="color: black;">em</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>3<span style="color: black;">&lt;/</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>4<span style="color: black;">&lt;/</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;">
      <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic2.zhimg.com/v2-7d2f5a4a9af83dca4c7176d75b1bd169_b.jpg" style="width: 50%; margin-bottom: 20px;"></div>
    </div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">3、(空格) 派生<span style="color: black;">选取</span>器</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">选取</span>某元素后面的所有子元素</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">派生<span style="color: black;">选取</span>器<span style="color: black;">准许</span>你<span style="color: black;">按照</span>文档的上下文关系来确定某个标签的样式</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这儿</span>还是用<span style="color: black;">第1</span>个例子</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">&lt;</span><span style="color: black;">style</span> <span style="color: black;">type</span><span style="color: black;">=</span><span style="color: black;">"text/css"</span><span style="color: black;">&gt;</span>
      <span style="color: black;">h1</span> <span style="color: black;">strong</span> <span style="color: black;">{</span>
      <span style="color: black;">color</span><span style="color: black;">:</span> <span style="color: black;">red</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">style</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>一代子元素<span style="color: black;">&lt;/</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>二代子元素<span style="color: black;">&lt;/</span><span style="color: black;">strong</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;">
      <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic3.zhimg.com/v2-4ccf266342c4fcc3e29b484daeecc752_b.jpg" style="width: 50%; margin-bottom: 20px;"></div>
    </div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">4、,(逗号)群组<span style="color: black;">选取</span>器</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">能够</span>对<span style="color: black;">选取</span>器进行分组,被分组的<span style="color: black;">选取</span>器就<span style="color: black;">能够</span>分享相同的声明</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">&lt;</span><span style="color: black;">style</span> <span style="color: black;">type</span><span style="color: black;">=</span><span style="color: black;">"text/css"</span><span style="color: black;">&gt;</span>
      <span style="color: black;">h1</span><span style="color: black;">,</span><span style="color: black;">h2</span><span style="color: black;">,</span><span style="color: black;">h3</span><span style="color: black;">{</span>
      <span style="color: black;">color</span><span style="color: black;">:</span> <span style="color: black;">blue</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">h4</span><span style="color: black;">,</span><span style="color: black;">h5</span><span style="color: black;">,</span><span style="color: black;">h6</span><span style="color: black;">{</span>
      <span style="color: black;">color</span><span style="color: black;">:</span> <span style="color: black;">red</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">style</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>案例1<span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>案例1<span style="color: black;">&lt;/</span><span style="color: black;">h2</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h3</span><span style="color: black;">&gt;</span>案例1<span style="color: black;">&lt;/</span><span style="color: black;">h3</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">h4</span><span style="color: black;">&gt;</span>案例2<span style="color: black;">&lt;/</span><span style="color: black;">h4</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h5</span><span style="color: black;">&gt;</span>案例2<span style="color: black;">&lt;/</span><span style="color: black;">h5</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h6</span><span style="color: black;">&gt;</span>案例2<span style="color: black;">&lt;/</span><span style="color: black;">h6</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic2.zhimg.com/80/v2-bf05b833dc8a180c95b0e99612515b89_720w.webp" style="width: 50%; margin-bottom: 20px;"></div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">5、+(加号)相邻兄弟<span style="color: black;">选取</span>器</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">可<span style="color: black;">选取</span>紧接在另一元素后的元素,且二者有相同父元素</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">&lt;</span><span style="color: black;">style</span> <span style="color: black;">type</span><span style="color: black;">=</span><span style="color: black;">"text/css"</span><span style="color: black;">&gt;</span>
      <span style="color: black;">span</span><span style="color: black;">+</span><span style="color: black;">em</span><span style="color: black;">{</span>
      <span style="color: black;">color</span><span style="color: black;">:</span> <span style="color: black;">red</span><span style="color: black;">;</span>
      <span style="color: black;">}</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">style</span><span style="color: black;">&gt;</span>

      <span style="color: black;">&lt;</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>案例1<span style="color: black;">&lt;/</span><span style="color: black;">span</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;</span><span style="color: black;">em</span><span style="color: black;">&gt;</span>案例2<span style="color: black;">&lt;/</span><span style="color: black;">em</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">h1</span><span style="color: black;">&gt;</span>
      <span style="color: black;">&lt;/</span><span style="color: black;">body</span><span style="color: black;">&gt;</span>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;">
      <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic3.zhimg.com/v2-2c1dbc6d5185617718d87f84cf3c3656_b.jpg" style="width: 50%; margin-bottom: 20px;"></div>
    </div>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;"><span style="color: black;"><span style="color: black;">css<span style="color: black;">选取</span>器</span><span style="color: black;">278 播放 · 1 赞同<span style="color: black;">视频</span></span></span><span style="color: black;"><img src="https://pic2.zhimg.com/v2-224f944b64a418b31d191417d01f90c6_r.jpg?source=2231c908" style="width: 50%; margin-bottom: 20px;"><span style="color: black;"><span style="color: black;">​</span></span></span></a></div>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;"><span style="color: black;"><span style="color: black;">https://www.bilibili.com/video/BV13b411g78D?t=400&amp;p</span></span></a>=46<span style="color: black;"><span style="color: black;">​</span>www.bilibili.com/video/BV13b411g78D?t=400&amp;p=46</span></div>




wrjc1hod 发表于 2024-10-7 17:22:05

可以发布外链的网站 http://www.fok120.com/

m5k1umn 发表于 4 天前

系统提示我验证码错误1500次 \~゛,

m5k1umn 发表于 3 天前

外链论坛的成功举办,是与各位领导、同仁们的关怀和支持分不开的。在此,我谨代表公司向关心和支持论坛的各界人士表示最衷心的感谢!
页: [1]
查看完整版本: css中“>”(大于号)、"~"(浪花号)、" "(空格)、","(逗号)、"+&q