Why would the height increase with a smaller font size?

后端 未结 5 1729
不知归路
不知归路 2020-12-08 21:39

I have a block with a certain line-height, where I insert content with the ::before pseudo element.

.block::before {
  content:\'text here\';
}
         


        
5条回答
  •  温柔的废话
    2020-12-08 22:26

    The font property on .sit:before is affecting this, the content property of css follows the current elements' css properties very stricly,

    Its because of this that you can be able to manipulate the value of the content property within the same style that the content property is created

    e.g

    sit {
      color: green;
    }
    sit:before{
      content: "text-here";
      color: red;
    } 
    

    this would emphasize the color to be red.

提交回复
热议问题