• css2024


    1 :has() Selector

        <ul>
            <li>
              <label> <input type="radio" name="source" />谷歌label>
            li>
            <li>
              <label> <input type="radio" name="source" />口碑label>
            li>
            <li>
              <label> <input type="radio" name="source" />其他label>
            li>
          ul>
    
      <style>
        ul li input:checked {
          accent-color: #f806e4;
        }
        ul li:has(input:checked) {
          border: 2px solid #f806e4;
        }
      style>
    

    2: Container Queries

    
    
    <section id="featured-course" class="courses">
      <div class="course">
        <div class="course-card">
          <img src="./images/gpt-thumb.webp" alt="" class="course-thumb" />
          <div class="course-info">
            <p class="course-name">ChatGPT - The Complete Guidep>
            <p>
              10x your productivity by using ChatGPT OpenAI APIs efficiently.
              Learn Midjourney, prompt engineering, AutoGPT and more!
            p>
          div>
        div>
      div>
    section>
    
     <style>
        .courses {
          display: flex;
          gap: 10px;
          justify-content: center;
          .course {
            container-type: inline-size;
            width: 100%;
            .course-card {
              display: flex;
              flex-direction: column;
              align-items: center;
              background: #620b79;
              border-radius: 5px;
              box-shadow: 1px 1px 1px #333333;
              width: 100%;
              height: 100%;
            }
          }
        }
    
        .course-thumb {
          max-width: 100%;
        }
        @container (min-width: 400px) {
          .course-card {
            flex-direction: row;
            align-items: normal;
          }
    
          .course-thumb {
            width: 50%;
          }
        }
      style>
    
    

    3: CSS Nesting

    .container {
      max-width: 800px;
      margin: auto;
      background-color: #f5f5f5;
      padding: 20px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      text-align: center;
    }
    
    .container h1 {
      color: #1a237e;
    }
    
    .container p {
      color: #757575;
    }
    
    .container {
      max-width: 800px;
      margin: auto;
      background-color: #f5f5f5;
      padding: 20px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      text-align: center;
    
      h1 {
        color: #1a237e;
      }
    
      p {
        color: #757575;
      }
    }
    
    4: New Value for text-wrap: balance
    
    .balanced-text h2 {
      color: #ffa726;
      text-wrap: balance;
    }
    
    .unbalanced-text h2 {
      color: #fc01da;
    }
    
    5:The :focus-visible Pseudo Class
    
            <main>
              <h1>Focus-visible Demoh1>
              <button>Click Mebutton>
              <input type="text" placeholder="Type here..." />
              <a href="#">Learn Morea>
            main>
    
        button:focus-visible,
        input:focus-visible,
        a:focus-visible {
          border-color: #1e88e5;
          box-shadow: 0 0 3px 2px #1e88e580;
        }
    
  • 相关阅读:
    HTML静态网页作业——我的家乡安庆
    卷积神经网络手写字符识别 - 深度学习 计算机竞赛
    初阶数据结构学习记录——여섯 栈
    C++ LibCurl 库的使用方法
    【python编程从入门到实践】P2 变量的规范
    假期第一天,第一次见丈母娘~
    下一代智能合约开发语言(一)
    【紧急情况】:回宿舍放下书包的我,花了20分钟敲了一个抢购脚本
    PCL学习笔记三
    vulnhub Photographer: 1
  • 原文地址:https://blog.csdn.net/u013165804/article/details/140461842