首页 > 解决方案 > HTML5/CSS3 - 无法更改 @media 上的字体大小

问题描述

代码有点大,但考虑到我不知道问题出在哪里,我将把我所有的 HTML5 文件和 CSS3 样式表粘贴到这里。

我现在开始从事网页设计工作,我正在重新设计我的第一个网站以使其具有响应性。

我知道当规则相同时,它会计算最后一个,保持它重复并不总是一个好习惯,但在我的情况下,规则并不完全相同,我使用不同的类(“caixa”意思是“盒子”,我为不同的场合做了不同的,至少我相信我在做。在这种情况下,我在编码@media(max-width:480px)时无法更改字体大小在每种情况下,无论我如何尝试......我的意思是,我什至尝试制作新课程只是为了改变它,但它就是不承认。伙计们,我快疯了。我做错了什么?

葡萄牙语课程的“对不起”,是的,我将它与英语单词,习惯混合在一起,任何疑问都可以问...哦,当然,对于英语不好的“对不起”,我在这该死的坚果想用 AF*CKING 爆炸一切火箭筒!!!

我的 HTML5 文件(我想弄乱的部分):

  <!-- REVISTA START -->
  <section class="posts-section">

    <section class="container-small">
      <!-- maria trindade  -->
      <section id="maria-trindade" class="caixa-destaque">

        <div class="title">
          <a href="revista\artistas\maria-trindade.html">
            <h2>VER DE PERTO</h2>
          </a>
        </div>

        <div class="img">
          <a href="revista\artistas\maria-trindade.html">
              <img src="_img/posts/maria-trindade/ver-de-perto/3.png" alt="">
            </a>
        </div>

        <div class="author">
          <a href="revista\artistas\maria-trindade.html">
            <h4>Maria Trindade</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\maria-trindade.html">
            <h5>CONTINUAR A LEITURA</h5>
          </a>
        </div>

      </section>
      <!-- bru pereira  -->
      <section id="bru-pereira" class="caixa-destaque">

        <div class="title title-small">
          <a href="revista\artistas\bru-pereira.html">
            <h2>Pacto</h2>
          </a>
        </div>

        <div class="text">
          <a href="revista\artistas\bru-pereira.html">
            <p>Muito me anima compor parte de um novo corpo, fazer corpo é uma arte, uma artesania que aprecio cada vez mais. Me instigo a pensar a partir desse lugar de entrelaçamento entre o somático e o coletivo, a partir desse corpo que fazemos sempre
              juntas e juntos. (...)</p>
          </a>
        </div>

        <div class="author">
          <a href="revista\artistas\bru-pereira.html">
            <h4>Bru Pereira</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\bru-pereira.html">
            <h5>CONTINUAR A LEITURA</h5>
          </a>
        </div>

      </section>
      <!-- carol do vale -->
      <section id="carol-do-vale" class="caixa-destaque">

        <div class="title">
          <a href="revista\artistas\carol-do-vale.html">
            <h2>O meu corpo é um templo: Eu respeito, eu curo, eu liberto</h2>
          </a>
        </div>

        <div class="text">
          <a href="revista\artistas\carol-do-vale.html">
            <p>É pessoalmente difícil escrever sobre algo tão íntimo como mera observadora. A trajetória dos corpos não-brancos diante de um sistema que esmaga a autoestima deve ser sempre narrada em primeira pessoa. Precisamos nos tornar protagonistas e
              não meros coadjuvantes em nossa própria história. (...)</p>
          </a>
        </div>

        <div class="author">
          <a href="revista\artistas\carol-do-vale.html">
            <h4>Carol do Vale</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\carol-do-vale.html">
            <h5>CONTINUAR A LEITURA</h5>
          </a>
        </div>

      </section>
      <!-- bruna gomes -->
      <section id="bruna-gomes" class="caixa-destaque proxima-fila">

        <div class="title">
          <a href="revista\artistas\bruna-gomes.html"><h2>CALO NA MÃO</h2></a>
        </div>

        <div class="img">
          <a href="revista\artistas\bruna-gomes.html">
            <img src="_img/posts/bruna-gomes-afonso/IMAGENS/2.png" alt="">
          </a>
        </div>

        <div class="text text-fix">
          <a href="revista\artistas\bruna-gomes.html">
            <p>O Projeto Calo na Mão traz como característica a brincadeira, no sentido de brincar a cultura popular, de brincar o maracatu, onde Corpo e Espaço estabelecem relações baseadas na vivência. (...)</p>
          </a>
        </div>

        <div class="author">
          <a href="revista\artistas\bruna-gomes.html">
            <h4>Bruna Gomes Afonso</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\bruna-gomes.html"><h5>CONTINUAR A LEITURA</h5></a>
        </div>

      </section>
      <!-- bruna diniz  -->
      <section id="bruna-diniz" class="caixa proxima-fila">

        <div class="text text-big poesia">
          <a href="revista\artistas\bruna-diniz.html">
            <p>corpo estrangeiro sem imagem<br>
             um espelho vazio que não sou capaz de ver e já não sei se um dia verei<br>
             se quer serei capaz de pintar algum rosto que imagino ser o meu<br>
             qualquer imagem que nos dissesse sobre aquele fio de navalha<br>
             pelo qual percorri e ainda percorrerei<br>
             imagine só o que serão nossos filhos<br>
             nossas filhas<br>
             que ainda não são frutos<br>
             e se forem algum, de quais flores irão nascer? (...)</p>
          </a>
        </div>

        <div class="author">
          <a href="revista\artistas\bruna-diniz.html">
            <h4>Bruna Diniz</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\bruna-diniz.html">
            <h5>CONTINUAR A LEITURA</h5>
          </a>
        </div>

      </section>
      <!-- bruno caldeira -->
      <section id="bruno-caldeira" class="caixa proxima-fila">

        <div class="title">
          <a href="revista\artistas\bruno-caldeira.html">
            <h2>Sobre um treze de maio garganta-abaixo</h2>
          </a>
        </div>

        <div class="text text-big poesia">
          <a href="revista\artistas\bruno-caldeira.html">
            <p>Segurar o silêncio do peso do mundo<br> Do sujo-modo de um comportamento sódico<br> Grilhões
              <br> y correntes<br> Ecoam
              <br> Na mente<br> Da Gente preta que sente<br> Manicômios
              <br> Escolas
              <br> Embranquecimentos
              <br> Traumas (...)
              <br><p>
          </a>
        </div>

        <div class="author">
          <a href="revista\artistas\bruno-caldeira.html">
            <h4>Bruno Caldeira</h4>
          </a>
        </div>

        <div class="continue-btn">
          <a href="revista\artistas\bruno-caldeira.html">
            <h5>CONTINUAR A LEITURA</h5>
          </a>
        </div>

      </section>

      <section class="btn-section">

        <div class="btn">
          <a href="revista\index.html">
            <h2>Revista</h2>
          </a>
        </div>

        <div id="btn-m" class="btn">
          <a href="edicoes\index.html">
            <h2>#1</h2>
          </a>
        </div>

      </section>

我的 CSS3 样式表:

/* -- GENERAL -- */

/*
* colors:
* #4C1919 - Bordô* -  rgba(178, 35, 35, .5) - rgba(233, 26, 26, 1)
* #BAA87C - Bege* - lighter => #CFC7B4
*
*
* fonts:
* 'Source Sans Pro', sans-serif;
* 'Oswald', sans-serif;
*/


/* global  */

body {
  font: 15px/1.5 'Oswald', 'Source Sans Pro', sans-serif;
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

body a:hover {
  text-decoration: none;
  color: lightgray;
}

section.logo-big img {
  width: 80%;
}

.container {
  width: 90%;
}

.logo {
  width: 60%;
}

.social {
  float: right;
  margin-top: -85px;
  margin-right: 100px;
  width: 150px;
  height: 60px;
}

.social-btns {
  margin-top: 10px;
  margin-left: 40px;
}

.social-btns img:hover {
  color: #000000;
  opacity: 0.7;
}

img.facebook-logo {
  margin-top: -5px;
  width: 30px;
  height: 30px;
}

img.instagram-logo {
  margin-top: 5px;
  width: 60px;
  height: 45px;
}

.section-title {
  text-align: center;
  margin-top: 100px;
  color: #ffffff;
  font-size: 120px;
}

/* landing-page */

.landing-page {
  width: 100%;
  height: 640px;
}

.menu {
  width: 100%;
  height: 90px;
  background: #212121;
  border-bottom: 5px solid black;
}

.menu ul {
  margin: 35px auto;

}

.menu ul li {
  display: inline;
}

.menu ul li a {
  font-size: 20px;
  color: #ffffff;
  padding: 10px;
  text-transform: uppercase;
}

.menu ul li a:hover {
  color: Dimgray;
}

.landing-page .logo {
  width: 50%;
  float: right;
  margin-right: 200px;
  text-align: center;
}

.landing-page .logo img {
  width: 80%;
  margin-left: -270px;
}

.links-lp {
  float: left;
  width: 17%;
  margin-top: 100px;
  margin-left: 100px;
}

.links-lp li a {
  color: #000000;
}

.links-lp li a:hover {
  font-weight: bold;
  background: rgba(233, 26, 26, 1);
}

.coluna01 {
  float: right;
  clear: right;
  margin-top: -200px;
  margin-right: 50px;
  width: 16%;
  height: 80px;
  background: #212121;
  border: 2px solid black;
  box-shadow: 2px 2px 2px Dimgray;
}

.coluna01 h1 {
  font-size: 30px;
  text-align: center;
  margin-top: 20px;
  color: #ffffff;
  text-shadow: 1.5px 1.5px Dimgray;
}

.coluna01 h1:hover {
  color: lightgray;
}


/* cita  */

section.cita {
  width: 100%;
  height: 420px;
  background: #ffffff;
  border-top: 20px solid #212121;
  border-bottom: 20px solid #212121;
}

.coluna02 {
  float: left;
  width: 30%;
  height: 400px;
  background: #212121;
}

.coluna02 .section-title {
  margin-top: 40px;
  margin-left: 40px;
  background: rgba(0,0,0, 1);

}

.coluna02 h2.section-title {
  width: 80%;
  height: 300px;
  padding-top: 60px;
  text-align: center;
  text-shadow: 3px 5px Dimgray;
}

section.cita img {
  width: 6%;
}

#aspas01 {
  float: left;
  margin-top: 130px;
  margin-left: 50px;
}

#aspas02 {
  float: right;
  margin-top: 140px;
  margin-right: 30px;
  transform: rotate(180deg);
}

.quote-text {
  float: left;
  margin-top: 115px;
  margin-left: 10px;
  font-family: 'Crimson Text', serif;
}

.quote-text a {
  color: #000000;
  font-size: 70px;
  font-style: italic;
  text-shadow: 0.5px 0.5px black;
}

.quote-text a:hover {
  color: Dimgray;
}

.quote-author h4 {
  font-size: 40px;
  font-style: normal;
  text-align: center;
  color: rgba(233, 26, 26, 1);
  font-family: 'Oswald', serif;
  text-shadow: 0.5px 0.5px rgba(233, 26, 26, 1);
}

.quote-author h4:hover {
  color: firebrick;
}

/* posts landing page */


section.posts-section {
  width: 100%;
  height: 1700px;
}

.caixa-destaque {
  float: left;
  width: 45%;
  height: 400px;
  margin: 50px 0 20px 140px;
}

.caixa-destaque .title {
  width: 80%;
}

.caixa-destaque .title h2 {
  font-size: 100px;
  color: rgba(233, 26, 26, 1);
  text-shadow: 4px 4px black;
}

.caixa-destaque .img {
  width: 100%;
}

.caixa-destaque .img img {
  width: 80%;
  margin-top: 10px;
  box-shadow: 4px 4px 4px black;
}

.caixa-destaque .text {
  width: 80%;
}

.caixa-destaque .text p {
  color: #000000;
  font-size: 20px;
  text-align: justify;
}

.caixa-destaque .author {
  float: right;
  text-align: center;
  margin-top: 10px;
  margin-right: 120px;
  width: 220px;
  height: 60px;
  padding: 10px;
  background: #000000;
  box-shadow: 2px 2px 2px dimgray;
}

.caixa-destaque .author h4 {
  font-size: 30px;
  color: #ffffff;
  text-shadow: 1px 1px black;
}

.proxima-fila {
  margin-top: 200px;
}

.poesia p {
  text-align: left;
}

.text-big a p {
  font-size: 20.6px;
}

.text-small a p {
  font-size: 18px;
}

.caixa {
  float: left;
  width: 30%;
  height: 200px;
  margin: 50px 0 20px 140px;
}

.caixa .title h2 {
  color:  rgba(233, 26, 26, 1);
}

.caixa .img {
  width: 80%;
}

.caixa .img img {
  width: 100%;
}

.caixa .text p {
  color: #000000;
}


.caixa .author {
  float: right;
  width: 220px;
  height: 60px;
  margin-top: 10px;
  border: 1px solid black;
  box-shadow: 2px 2px 2px dimgray;
  background: #000000;
}


.caixa .author a,
.caixa .author h4 {
  font-size: 25px;
  margin-top: 10px;
  text-align: center;
  color: #ffffff;
  text-shadow: 0.5px 0.5px black;
}

.caixa .author a:hover,
.caixa .author h4:hover,
.caixa-destaque .author a:hover,
.caixa-destaque .author h4:hover {
  color: lightgray;
}

.caixa .continue-btn,
.caixa-destaque .continue-btn {
  float: left;
  width: 220px;
  height: 60px;
  margin-top: 10px;
  border: 1px solid black;
  box-shadow: 2px 2px 2px dimgray;
  background: rgba(233, 26, 26, 1);
}

.caixa .continue-btn a,
.caixa-destaque .continue-btn a {
  float: left;
  margin-top: 15px;
  margin-left: 30px;
  text-align: center;
  font-size: 20px;
  color: #ffffff;
  text-shadow: 1.5px 1.5px black;
}

section.btn-section {
  float: left;
  width: 300px;
  height: 400px;
  margin-left: 230px;
  margin-top: 10px;
}

.btn {
  width: 300px;
  height: 70px;
  background: rgba(233, 26, 26, 1);
  box-shadow: 3px 3px 3px Dimgray;
  border-radius: 0;
  border: 2px solid black;
}

#btn-m {
  margin-top: 110px;
}

.btn a h2 {
  color: #ffffff;
  font-size: 40px;
  text-shadow: 1.5px 1.5px black;
}

.btn a:hover,
.btn h2:hover {
  color: lightgray
}

section#maria-trindade.caixa-destaque .title h2 {
  font-size: 90px;
}

section#bru-pereira.caixa-destaque {
  float: right;
  margin-top: -420px;
  margin-right: 40px;
}

section#bru-pereira.caixa-destaque .title h2 {
  text-align: center;
  font-size: 100px;
}

#carol-do-vale.caixa-destaque {
  float: right;
  margin-top: -120px;
  margin-right: 40px;
}

#carol-do-vale .title {
  margin-top: 50px;
  margin-bottom: 10px;
}

#carol-do-vale .title h2 {
  font-size: 30px;
  text-shadow: 1px 1px black;
}

#bruna-gomes.caixa-destaque {
  margin-top: -170px;
}

#bruna-gomes.caixa-destaque .title h2 {
  font-size: 90px;
}

#bruna-gomes.caixa-destaque .text {
  margin-top: 10px;
}

#bruna-gomes.caixa-destaque .author h4 {
  font-size: 25px;
}

#bruna-diniz.caixa {
  width: 47%;
  margin: -55px 0px 0px -50px;
}

#bruna-diniz.caixa .author {
  margin-right: 140px;
}

#bruno-caldeira.caixa {
  width: 47%;
  margin: 160px 0px 0px -50px;
}

#bruno-caldeira.caixa .title h2 {
  font-size: 30px;
}

#bruno-caldeira.caixa .text {
  margin-top: 10px;
}

#bruno-caldeira.caixa .author {
  margin-right: 140px;
}


/* eventos */

section.events-section {
  width: 100%;
  height: 500px;
  background: #212121;
}

.agenda-text {
  width: 22%;
  float: left;
  text-align: justify;
  margin-top: 50px;
  margin-left: 80px;
  height: 400px;
}

.agenda-text h3 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 10px;
  text-shadow: 1px 1px black;
}

.evento01,
.evento02 {
  float: left;
}

.evento02 {
  margin-top: 50px;
}

#eventos-text a h3,
#eventos-text a p {
  text-shadow: 1px 1px black;
  color: #ffffff;
}

#eventos-text a h3:hover,
#eventos-text a p:hover {
  color: Dimgray;
}

#eventos {
  float: left;
  margin-top: 20px;
  margin-left: 70px;
}

#eventos h1 {
  text-shadow: 2px 2px black;
}

.calendario {
  float: left;
  margin-top: 200px;
  margin-left: -395px;
}

.newsletter-section {
  margin-top: 20px;
  margin-right: 50px;
  width: 28%;
  float: right;
  height: 430px;
  background: #ffffff;
}

.newsletter-title {
  float: left;
  margin-top: 0px;
  margin-left: 55px;
}

.newsletter-section .logo img {
  width: 100%;
  margin-left: 80px;
}

.newsletter-title h3 {
  margin-left: -10px;
  font-size: 60px;
  text-shadow: 2px 2px rgba(233, 26, 26, 1);
}

#mc_embed_signup {
  float: left;
  margin: 20px 0 10px 60px;
}

#mc_embed_signup input[type=email] {
  width: 87%;
  height: 40px;
  margin: 0 auto;
}

#mc_embed_signup input[type=submit] {
  width: 30%;
  height: 40px;
  margin-left: 90px;
  font-size: 18px;
}


.nav-bar-end {
  width: 100%;
  height: 200px;
  background: #212121;
}

.nav-end ul {
  float: left;
  margin: 80px 0 0 300px;
}

.nav-end ul li{
  display: inline;
  margin-left: 20px;
}

.nav-end ul li a {
  text-transform: uppercase;
  font-size: 28px;
  color: #ffffff;
  text-shadow: 1.5px 1.5px black;
}

.nav-end ul li a:hover {
  font-weight: normal;
  color: lightgray;
}

.footer-section {
  width: 100%;
  height: 100px;
  background: #212121;
}

.footer-text {
  width: 50%;
  margin: 0 auto;
  text-align: center;
}

.footer-text h6 {
  color: #ffffff;
  text-shadow: 1px 1px black;
}

.footer-text a {
  color: rgba(233, 26, 26, 1);
}

.footer-text a:hover {
  color: firebrick;
}

/* MAIN CSS END */

@media (max-width: 480px) {

  section.cita,
  .calendario {
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    border: none;
    display: none;
  }

  .coluna02 h2,
  .quote-text h3,
  .quote-author h4 {
    font-size: 0;
  }

  .landing-page,
  .landing-page .menu,
  .landing-page .links-lp,
  .landing-page .coluna01,
  .landing-page .btn-section,
  .cita,
  .cita .coluna02,
  .cita .quote-text,
  .cita .quote-author,
  .posts-section,
  #maria-trindade,
  #bru-pereira,
  #carol-do-vale,
  #bruna-gomes,
  #bruna-diniz,
  #bruno-caldeira,
  .posts-section .caixa-destaque,
  .posts-section .caixa,
  .posts-section .btn-section,
  .events-section,
  .events-section .agenda,
  .events-section #eventos,
  .events-section .calendario,
  .newsletter-section,
  .nav-bar-end,
  .nav-bar-end nav,
  .nav-bar-end nav ul,
  .footer-section {
    float: none;
    margin: 0;
    padding: 0;
  }

  .clear-fix {
    clear: both;
  }

  body {
    margin: 0;
    padding: 0;
    width: 100%;
  }

  .container-small {
    width: 80%;
    text-align: center;
    margin: 0;
    padding: 0;
  }

  .section-title {
    font-size: 30px;
  }

  /* global */

  /* landing-page */

  .landing-page {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
  }

  .landing-page .menu {
    display: block;
    width: 100%;
    height: 200px;
    margin-bottom: 10px;
  }

  .landing-page .menu nav {
    padding-top: -20px;
    width: 40%;
    height: 100%;
  }

  .landing-page .menu ul {
    margin-top: 25px;
    margin-left: 20px;
  }

  .landing-page .menu li {
    float: left;
  }

  .landing-page .menu a {
    font-size: 16px;
  }

  .landing-page .social {
    width: 70px;
    height: 150px;
    margin-top: -180px;
    margin-right: 20px;
  }

  .landing-page .social-btns {
    margin: 0;
    padding: 0;
  }

  .landing-page .facebook-logo {
    margin-top: 20px;
    margin-left: 20px;
  }

  .landing-page .instagram-logo {
    margin-top: 10px;
    margin-left: 5px;
  }

  .landing-page .logo {
    margin: 0 auto;
    padding: 0;
    width: 80%;
  }

  .landing-page .logo img {
    width: 100%;
    margin-top: -20px;
    margin-left: -40px;
  }

  .landing-page .links-lp {
    margin-top: 40px;
    width: 100%;
  }

  .landing-page .links-lp ul {
    text-align: center;
  }

  .landing-page .coluna01 {
    margin-top: 20px;
    width: 100%;
    display: block;
  }


  /* revista posts */

  section.posts-section {
    width: 100%;
    height: 2000px;
  }





}

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
ol,ul { list-style:none; }
caption,th { text-align:left; }
h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }
q:before,q:after { content:''; }
abbr,acronym { border:0; }

标签: htmlcssmediaresponsivefont-size

解决方案


在文件的末尾,您有很多“重置”类。CSS 文件是从上到下阅读的,以后的规则会替换上面的规则。

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
ol,ul { list-style:none; }
caption,th { text-align:left; }
h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }
q:before,q:after { content:''; }
abbr,acronym { border:0; }

此处的这一行将重置您的媒体查询,因为它出现在代码中:

h1,h2,h3,h4,h5,h6 { font-size:101.1%; font-weight:normal; }

我还建议检查类似 normalize.css 的内容:http: //nicolasgallagher.com/about-normalize-css/

您可以将其包含在文件的开头。

编辑:

仔细观察,并非所有文本在断点处都有较小的尺寸,例如,您可以添加:

@media (max-width: 480px) {

    section#maria-trindade.caixa-destaque .title h2 {
    font-size: 30px;
    }
}

您还可以根据需要添加任意数量的媒体块,这样您可能会发现在它影响的规则之后添加每个媒体块会更容易。这可以在您学习时为您提供帮助,但确实会增加代码的长度。

.someclass {
    font-size: 10pt;
}

@media (max-width: 480px) {
    .someclass {
        font-size: 8pt;
    }
}

.someclass2 {
    color: red;
    font-size: 20pt;
}

@media (max-width: 480px) {
    .someclass2 {
        font-size: 15pt;
    }
}

另一方面,您的选择器非常复杂,可能会增加您的问题。这里有一些提示:

section#maria-trindade.caixa-destaque .title h2 {
    font-size: 30px;
}

在上述规则中,您不需要部分或类#maria-trindade.title h2 应该是您需要的每个并简化了特异性,请参阅:https ://stuffandnonsense.co.uk/archives/css_specificity_wars.html

我还建议考虑使用像 BEM 这样的东西,因为它可以让你的课程更简单: http: //getbem.com/

还有一些实用程序类,例如,所有红色标题都有相同的视觉样式,但每个都有一个长而复杂的选择器。

<h2 class="t-1">My title</h2>

/* style for primary headers */

.t-1 {
    font-size: 100px;
    color: rgba(233, 26, 26, 1);
    text-shadow: 4px 4px black;
}

您可以重复使用这种简单的样式,并且如果您的 HTML 结构发生变化,您不需要编辑 CSS。

我希望这有帮助!:)


推荐阅读