[英]Vertically Center Icon with CSS
I am building a web site. 我正在建立一个网站。 My web site will have blocks of content.
我的网站将包含内容块。 Each block will have a title, some text, and an icon.
每个块都有一个标题,一些文本和一个图标。 My challenge is, I'm trying to vertically center each icon in the block.
我的挑战是,我正在尝试垂直放置块中的每个图标。 Currently, I have the following HTML or you can look at the jsfiddle .
当前,我有以下HTML或您可以查看jsfiddle 。
<blockquote>
<div class="row">
<div class="small-10 columns">
<h4>The Block Title</h4>
<em>Some small blurb</em>
<p>Here is a paragraph relating to this block. It may include a couple of sentences. These sentences will wrap. Ultimately, the heart needs to be vertically centered.</p>
</div>
<div class="small-2 columns">
<span class="fi-heart" style="font-size:4rem;"> </span>
</div>
</div>
</blockquote>
In this code block, I'm using Zurb Foundation to help with layout. 在此代码块中,我将使用Zurb Foundation帮助进行布局。 However, I can't seem to get the heart icon to center vertically in my right column.
但是,我似乎无法使心脏图标在我的右栏中垂直居中。 Does anyone know how I can do this with CSS?
有谁知道我怎么用CSS做到这一点?
Thank you 谢谢
在您的内联样式中为<span class="fi-heart">
添加一个line-height
属性,其值等于font-size:
font-size:4em; line-height: 4em
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.