【问题标题】:Spacing irregularities in htmlhtml中的间距不规则
【发布时间】:2020-10-13 00:41:51
【问题描述】:

我正在尝试格式化 html 中的文本,但随机间距不会消失。我尝试修复填充和边距,但这没有任何帮助。

我是网络开发的新手,所以我希望能得到一些帮助和指导!

这是我的代码:

<center> <h2> Hello! </h3>  </center> 
    <h4 style="left: 10px; padding-left: 10px; margin: 0px"> Some thing goes here </h5>
    <h6 style = "right: 90px; padding-left: 10px; padding-bottom: 0px; margin: 0px"> test </h6>
    <h6 style = "padding-left: 20px; padding-top: 0px; padding-right: 20px; font-style: regular;"> description </h6>
    

【问题讨论】:

  • 如果您使用的是 chrome,请使用检查功能。即使在您的 sn-p 中,您也可以看到问题。
  • 你玩弄那些h标签的边距和填充,而且语法错误,例如&lt;h2&gt;...`被h4关闭。你能告诉我们你想要实现什么吗?

标签: html css padding margin


【解决方案1】:

我强烈推荐使用 Chrome 的检查功能(称为 DevTools),它会打开一个新窗口,提供客户端编码,让开发变得更加容易!


作为一个简短的总结,使用 DevTools,您可以:

  • 实时修改站点的外观和与用户交互的方式(Elements 选项卡)。这只是客户端(HTML、CSS、JS 等)。默认情况下,CSS 在右侧。您可以修改 CSS 等代码以满足您的需求,然后将其保存到您的开发文件中。
  • 检查 JavaScript 输出。这非常适合使用 console.log() 调试 JS 或检查 JSON 输出等内容,这些内容将在可理解的可折叠视图(Console 选项卡)中分解。
  • 定位内部/外部引用,如图片、.js、.css 等,您可以实时修改/调试。注意:当查看像 .js 文件这样的数据被缩小时,点击左下角的{}pretty-print 使其更清晰。
  • 还有其他功能,但这些功能目前最适合您。

这将对齐柱状文本。唯一的变化是 padding-left: 20px;padding-left: 10px;

<center> <h2> Hello! </h3>  </center> 
    <h4 style="left: 10px; padding-left: 10px; margin: 0px"> Some thing goes here </h5>
    <h6 style = "right: 90px; padding-left: 10px; padding-bottom: 0px; margin: 0px"> test </h6>
    <h6 style = "padding-left: 10px; padding-top: 0px; padding-right: 20px; font-style: regular;"> description </h6>
    

或者,如果您想删除description 之前/之后的空格,则需要像这样添加margin: 0px;

<center> <h2> Hello! </h3>  </center> 
    <h4 style="left: 10px; padding-left: 10px; margin: 0px"> Some thing goes here </h5>
    <h6 style = "right: 90px; padding-left: 10px; padding-bottom: 0px; margin: 0px"> test </h6>
    <h6 style = "margin: 0px; padding-left: 10px; padding-top: 0px; padding-right: 20px; font-style: regular;"> description </h6>
    

【讨论】:

  • 嗨!抱歉,我指的是“测试”和“描述”之间的空格,以及“这里有什么”和“你好”之间的空格
  • 嗨。不要抱歉。由于您的帖子没有指定,我已经编辑了我的答案以包括两者:)
猜你喜欢
  • 2021-04-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-09
  • 1970-01-01
  • 2015-05-27
相关资源
最近更新 更多