Home > Article > Web Front-end > Share a detailed explanation of how to write spaces in CSS
Characters and HTML entities | Description and instructions |
---|---|
## | This is the space we use most, which is the space generated by pressing the space key. In HTML, if you use the space bar to generate this space, the spaces will not accumulate (only count as 1). To be accumulated, you need to use html entity representation. In order to make it easier to remember, I always call this space "nb space (sp - space)", although it is not actually awesome. The width occupied by this space is significantly and strongly affected by the font. It will cause some minor damage in the inline-block layout, but it is an indispensable element in the aligned layout. He is a little thing that people love and hate. |
## The scientific name of this space is unknown. To make it easier to remember, we might as well call it "e n-ian space". This space inherits the consistent characteristics of the space family: | transparencydrops! This space has a very robust feature, that is, the width occupied by its is exactly 1/2 the Chinese width , and it is basically not affected by the font. |
## The scientific name of this space is unknown. To make it easier to remember, we might as well call it "Devil (em-o) Space". This space also inherits the consistent characteristics of the space family: transparency | drops! This space also has a very robust feature, that is, the width occupied by is exactly 1 Chinese width , and it is basically not affected by the font. |
|
其中的 和 ,由于具有某一超赞的特性,使其可以登上web届的舞台!什么特性呢?如上表加粗展示,1. 透明; 2. 宽度正好跟中文正好是1:2和1:1的关系,于是,一些中文排版对齐什么的,直接就可以使用这两个空格调节,如: <ul> <li class="li">姓  名:<input type="text" /></li> <li class="li">手 机 号:<input type="text" /></li> <li class="li">电子邮箱:<input type="text" /></li> </ul> 当中文和英文混杂的时候,使用
「叉三千」指什么呢?哈哈,其实是全角空格。 中文字体都是等宽的,一个全角空格的宽度就是一个普通中文的宽度。所以,上面的demo中 但是,我们不能直接在页面中打全角空格,因为在大多数编辑器中空格是透明滴,很容易就被删掉;另外,HTML压缩时候,空格很可能被干掉!咋办?需要转换书写形式。 在web页面上,一般有3种书写:
而上面的 稍等,你刚说了工具,什么工具!? 哈,这位同学好敏锐,我是有一个私藏的小工具,可以把任意字符转换成HTML识别格式,若有兴趣,您可以狠狠地点击这里:任意字符转换成HTML识别格式工具页面 使用了这个工具,你会发现
再科普点关于字符的实用知识吧: 因此,想在HTML/JS/CSS中转义“我”这个汉字,分别是:
考虑到直接 .half:before { content: '\2002'; speak: none; } .full:before { content: '\2003'; speak: none; } 这样,占位的空格字符即不能读,也不能选了。 |
The above is the detailed content of Share a detailed explanation of how to write spaces in CSS. For more information, please follow other related articles on the PHP Chinese website!