我们可以轻松删除内联块元素之间的空格。在继续之前,让我们首先创建一个 HTML 文档并添加带空格的内联块元素。
我们将使用值为 inline-block 的 display 属性设置内联块元素的样式 -
nav a { display: inline-block; background: blue; color: white; text-decoration: none; font-size: 35px; }
我们已经为下面给定的 元素设置了上述样式 - <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> 现在让我们看看添加带空格的内联块元素的完整示例 -立即学习“前端免费学习笔记(深入)”; 示例 <!DOCTYPE html> <html> <head> <title>Inline block elements</title> <style> nav a { display: inline-block; background: blue; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements with space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html> 使用 font-size 属性删除内联块元素之间的空格 我们可以使用 font-size 属性删除内联块元素之间的空格。 font-size 属性影响元素文本的大小。以下是可能的值 - xx-small - 将元素文本的大小设置为小于 x-small 值所产生的大小。 x-small - 将元素文本的大小设置为小于值small所产生的大小。 small - 将元素文本的大小设置为小于中值产生的大小。 medium - 将元素文本的大小设置为小于值large所产生的大小,并大于值small所产生的大小。 large - 将元素的文本设置为大于中值结果的大小。 x-large - 将元素文本的大小设置为大于值large所产生的大小。 xx-large - 将元素文本的大小设置为大于值 xlarge 所产生的大小。 larger - 将元素的文本设置为大于其父元素的文本。 smaller - 将元素的文本设置为小于其父元素的文本。 length - 任何允许的长度值。 font-size 不允许使用负长度值。 百分比 - 设置元素相对于其父元素的文本大小。 现在让我们看一个删除内联块元素之间的空格的示例 - <!DOCTYPE html> <html> <head> <title>Inline block elements without space</title> <style> nav { font-size: 0; } nav a { display: inline-block; background: blue; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements without space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html> 使用 marginright 属性删除内联块元素之间的空格 我们可以使用 margin-right 属性删除内联块元素之间的空间 - 示例 <!DOCTYPE html> <html> <head> <title>Inline block elements without space</title> <style> nav a { display: inline-block; background: blue; margin-right: -4px; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements without space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html> 以上就是如何在HTML中删除内联/内联块元素之间的空格?的详细内容,更多请关注IT视界其它相关文章!
<nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav>
现在让我们看看添加带空格的内联块元素的完整示例 -
立即学习“前端免费学习笔记(深入)”;
<!DOCTYPE html> <html> <head> <title>Inline block elements</title> <style> nav a { display: inline-block; background: blue; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements with space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html>
我们可以使用 font-size 属性删除内联块元素之间的空格。 font-size 属性影响元素文本的大小。以下是可能的值 -
xx-small - 将元素文本的大小设置为小于 x-small 值所产生的大小。
x-small - 将元素文本的大小设置为小于值small所产生的大小。
small - 将元素文本的大小设置为小于中值产生的大小。
medium - 将元素文本的大小设置为小于值large所产生的大小,并大于值small所产生的大小。
large - 将元素的文本设置为大于中值结果的大小。
x-large - 将元素文本的大小设置为大于值large所产生的大小。
xx-large - 将元素文本的大小设置为大于值 xlarge 所产生的大小。
larger - 将元素的文本设置为大于其父元素的文本。
smaller - 将元素的文本设置为小于其父元素的文本。
length - 任何允许的长度值。 font-size 不允许使用负长度值。
百分比 - 设置元素相对于其父元素的文本大小。
现在让我们看一个删除内联块元素之间的空格的示例 -
<!DOCTYPE html> <html> <head> <title>Inline block elements without space</title> <style> nav { font-size: 0; } nav a { display: inline-block; background: blue; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements without space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html>
我们可以使用 margin-right 属性删除内联块元素之间的空间 -
<!DOCTYPE html> <html> <head> <title>Inline block elements without space</title> <style> nav a { display: inline-block; background: blue; margin-right: -4px; color: white; text-decoration: none; font-size: 35px; } </style> </head> <body> <h1>The inline-block elements</h1> <p>Below are the inline-block elements without space:</p> <nav> <a href="#">Tutorials</a> <a href="#">point</a> </nav> </body> </html>
以上就是如何在HTML中删除内联/内联块元素之间的空格?的详细内容,更多请关注IT视界其它相关文章!
本篇文章给大家分享6个值得一学的...
隐藏html标签的方法:1、通过...
html设置编码utf8的方法:...
html设置字体的方法:1、【f...
本篇文章给大家介绍html隐藏文...
本篇文章给大家介绍html页面实...
ithorizon