Home > Article > Web Front-end > How to clear white space in css
The way to clear white space in css is to add the attribute font-size to the outer element, set the attribute value to 0, and specify the specific size of the font on the inner element, such as [font-size : 0;].
The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.
If we want to clear the space between inline elements, the best way is to set font-size:0 on the outer element; and also specify the specific font size on the inner element.
The font-size property is used to set the font size.
Common attribute values:
smaller Set font-size to a smaller size than the parent element.
larger Set font-size to a larger size than the parent element.
#length Set font-size to a fixed value.
% Set font-size to a percentage value based on the parent element.
The code example is as follows:
ul.inline-block-list { /* 比如 ul 或者 ol元素 */ font-size: 0; } ul.inline-block-list li { font-size: 14px; /* 设置具体的字体大小 */ } ul.inline-block-list { /* 比如 ul 或者 ol元素 */ font-size: 0; } ul.inline-block-list li { font-size: 14px; /* 设置具体的字体大小 */ }
In order to offset the font attribute of the outer element, the font-size attribute must be specified on the inner element. Of course, this is very simple.
Related recommendations: css video tutorial
The above is the detailed content of How to clear white space in css. For more information, please follow other related articles on the PHP Chinese website!