html - 忽略内联 block 的社交图标

标签 html css wordpress

我创建了三个社交图标并排坐在一排(请参阅我的工作 JSFiddle - here)。

然而,当我将它们放在我的 Wordpress 博客上时,它们不是并排坐在一起,而是彼此叠放在一起,请参阅 - https://www.moneynest.co.uk/testing-social-icons/ .

如何让我的 Wordpress 版本模仿我的 JSFiddle 版本?

HTML

<div data-sumome-share="Facebook" data-sumome-share-text="Great article by the Money Nest team." class="social-icons" id="facebook_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/facebook-white.png" height="20px" class="social-image-align" >share<span data-sumome-share-count="share"></span></div><!--
--><div data-sumome-share="Twitter" data-sumome-share-text="Great article, check it out..." class="social-icons" id="twitter_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/twitter-white.png" height="20px" class="social-image-align">share<span data-sumome-share-count="share"></span></div><!--
--><div data-sumome-share="Linkedin" data-sumome-share-text="Great article, check it out..." class="social-icons" id="linkedin_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/linkedin-white.png" height="20px" class="social-image-align">share<span data-sumome-share-count="share"></span></div>

CSS

social-image-align {
  position: relative;
  top: -1px;
height: 20px;
  margin-right: 8px;
}

#facebook_icon {
      background-color: #3B5997;
}

#facebook_icon:hover {
  background-color: #4264a9;
}

#twitter_icon {
      background-color: #1bb2e9;
}

#twitter_icon:hover {
  background-color: #32baeb;
  }

#linkedin_icon {
      background-color: #008cd0;
}

#linkedin_icon:hover {
  background-color: #007bb6;
}

.social-icons {
    padding: 8px 5px;
    text-align: center;
    width: 30%;
    display: inline-block;
    color: white;
    text-transform: uppercase;
}

最佳答案

WordPress 似乎在您的 <div> 之间添加了一些段落标签的

如果您无法删除它们,请设置它们的 displaynone像这样。

.entry-content p{
	display: none;
}

.social-icons {
    padding: 8px 5px;
    text-align: center;
    width: 30%;
    display: inline-block;
    text-transform: uppercase;
}
<div class="entry-content">
	<div data-sumome-share="Facebook" data-sumome-share-text="Great article by the Money Nest team." class="social-icons" id="facebook_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/facebook-white.png" height="20px" class="social-image-align" >share<span data-sumome-share-count="share"></span></div><p><!--
	--></p><div data-sumome-share="Twitter" data-sumome-share-text="Great article, check it out..." class="social-icons" id="twitter_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/twitter-white.png" height="20px" class="social-image-align">share<span data-sumome-share-count="share"></span></div><p><!--
	--></p><div data-sumome-share="Linkedin" data-sumome-share-text="Great article, check it out..." class="social-icons" id="linkedin_icon"><img src="https://www.moneynest.co.uk/wp-content/uploads/2017/01/linkedin-white.png" height="20px" class="social-image-align">share<span data-sumome-share-count="share"></span></div>
</div>

关于html - 忽略内联 block 的社交图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41811701/

相关文章:

html - Bootstrap + form group inside a form horizo​​ntal 提供水平滚动条

javascript - body 标记上的 OnMouseMove 导致子下拉元素出现问题

css - 将 rgba 转换为 CSS 中的单独属性

wordpress - 在 woocommerce 结帐表单处理后更新用户元数据

html - 如何在鼠标悬停时添加淡入淡出效果

java - 生成动态表以及动态单选按钮以进一步在 JSP 中生成动态表

javascript - 表中的 Accordion 问题 - jquery

javascript - $document.ready() 在 servlet 中不工作

jquery - 多列表下拉绝对位置在彼此之上和之下?

php - WordPress 安装 PHP 报错