【问题标题】:how to have spacing html/css如何有间距 html/css
【发布时间】:2010-08-26 21:29:38
【问题描述】:

我在这里有一个 html/css 代码,这将导致这个。见下图。 我想在第一个“未来事件”下添加另外 3 列我该怎么做? 已经发布了代码:谢谢 段落间距的代码是什么? 谢谢 请在此处查看图片: http://www.freeuploadimages.org/images/nc1xjrptgddvk1yxvnad.png

我想调整“未来事件”的空间,就像我想把它放在顶部一样。 这可能吗?

这是代码: 请在此处查看更新的代码: http://jsfiddle.net/b5fMe/4/

我需要在两者之间有一个分隔符,但是


不起作用:-(

【问题讨论】:

  • 我们也可以有一些源 HTML 和 CSS 吗?还是一个活生生的例子?
  • +1 用于鼠标绘制的箭头。哟!
  • 当您说“我想在此处添加这个”时,您是指空白吗?
  • 我很确定那不是 XHTML 1.0 过渡的有效 HTML
  • 现场示例:jsfiddle.net/b5fMe

标签: html css spacing


【解决方案1】:

你有 CSS:

   #content .secondary-heading{
   font-size:18px;
font-weight:normal;
color:#333;
font-style:normal;
font-family:Georgia;
text-align:left;
margin-bottom:150px;
    }

具体说明:

margin-bottom:150px;

但是在你的 HTML 中你有第二个的内联代码

<h2 class="secondary heading"> 声明:

style="font-size: 18px;font-weight: normal;color: #333; font-style: normal;font-family: Georgia;text-align: left;margin-bottom: 15px;"

去掉这个内联样式,它的行为应该符合预期。

编辑

在 CSS 中:删除内联样式后将margin-bottom:150px; 更改为margin-bottom:15px;

希望有帮助!

【讨论】:

  • @Kyle:我实际上隐藏了那个代码,我只是这样写的:

    未来事件

    Sed ut persp iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque。
  • jsfiddle.net/b5fMe/1 检查一下,只需删除 h2 标记中的内联样式即可。在 Chrome 上工作。
  • 谢谢,当您说内联样式时,是在 CSS 中还是在 HTML 中?因为在 html 中,我实际上评论了它。:这就是我现在所拥有的:

    Future Event

    Sed ut persp iciatis unde omn​​is iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque.
  • 在 HTML 中,奇怪的是,如果您将其注释掉,它应该可以工作。尝试直接删除它。
【解决方案2】:

要复制这三个块,实际上您必须复制行,包括它们的tr 标记。 我复制/粘贴代码:

<tr>
        <td class="content threecol first" style="font-size: 11px; line-height: 1.4em; color: rgb(68, 68, 68); width: 25%; padding-right: 20px; padding-left: 0pt; padding-top: 20px; border-right: 1px solid rgb(204, 204, 204);"><!--<h2 class="secondary-heading" 
      style="font-size: 18px;font-weight: normal;color: #333;font-style: 
      normal;font-family: Georgia;text-align: 
     left;margin-bottom: 15px;">Future Event</h2>-->

          <h2 class="secondary-heading">Future Event</h2>
          <p2 class=".secondary-paragraph"> Sed ut persp iciatis unde omnis iste natus error sit voluptatem 
            accusantium doloremque laudantium, totam rem aperiam, eaque.</p2></td>
        <td class="content threecol" style="font-size: 11px; line-height: 1.4em; color: rgb(68, 68, 68); width: 28%; padding-right: 20px; padding-left: 20px; padding-top: 20px; border-right: 1px solid rgb(204, 204, 204);"><h2 class="secondary-heading" style="font-size: 18px; font-weight: normal; color: rgb(51, 51, 51); font-style: normal; font-family: Georgia; text-align: left; margin-bottom: 15px;">Future Event</h2>
          <p>Sed ut persp iciatis unde omnis iste 
            natus error sit voluptatem accusantium doloremque laudantium, totam rem 
            aperiam, eaque.</p></td>
        <td class="content threecol last" style="font-size: 11px; line-height: 1.4em; color: rgb(68, 68, 68); width: 28%; padding-right: 15px; padding-left: 20px; padding-top: 20px; margin-right: 15px; border: 0pt none;"><p class="btn" style="text-align: center; background: none repeat scroll 0% 0% rgb(45, 45, 45); border: 3px solid rgb(235, 235, 235);">&nbsp; </p>
          <p class="btn" style="background: none repeat scroll 0% 0% rgb(45, 45, 45); border: 3px solid rgb(235, 235, 235);"> <a href="#" style="color: rgb(255, 255, 255); text-decoration: none; font-weight: normal; font-size: 26px; font-family: Georgia; text-transform: uppercase; text-align: center; display: block; padding: 20px 0pt;"> <img height="50" border="0" width="119" alt="" src="http://gallery.mailchimp.com/86b4d752e397a2dbd09e3dd60/images/logowikima4.gif" style="text-align: center; display: block;"></a> </p>
          <p class="btn" style="text-align: center; background: none repeat scroll 0% 0% rgb(45, 45, 45); border: 3px solid rgb(235, 235, 235);">&nbsp; </p>
          <p> Let us know if you are coming and if you have guests.</p>
      </td></tr>

在您的代码中,您会找到上面的代码,只需将其粘贴在下面即可。

关于间距,你可以修改,给line-heightsecondary-heading类。

例如.secondary-heading {line-height:1.4;},根据需要修改即可。

【讨论】:

  • @Sotiris:我在 .secondary-heading 和 .secondary-paragraph 下添加了行高。但它仍然是一样的。空间还是很大的。
  • 空间是什么?在第一个块中有一个很大的空间,因为您在 h2 上添加了secondary-heading。如果删除它,则与第二个块相同。如果你想换个空间,请告诉我。
  • 我希望它是“未来事件”和“文本”开始之间的正常空间。没错,有一个很大的空间,这就是我想在这里解决的问题我不想要那么大的空间,我想在标题“未来事件”和“文本”之间留一个小空间,所以你的意思是我有删除次要标题或次要段落?
  • 嗯,我看看,其实没有理由删除secondary-heading。在您的 CSS 中,您会发现以下 #content .secondary-heading{font-size:18px; font-weight:normal; color:#333; font-style:normal; font-family:Georgia; text-align:left; margin-bottom:150px;} 只需删除 margin-bottom:150px; 即可:)
  • @Sotiris,是的,谢谢,我忘了把点放在副标题上。所以它应该是“.secondary-heading”,事情是它在下面很远。我可以在顶部移动一点吗?
猜你喜欢
  • 1970-01-01
  • 2014-08-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-18
  • 1970-01-01
  • 1970-01-01
  • 2018-08-04
相关资源
最近更新 更多