center align icon in circle/disc

user1261774

Using CSS, I have a display that places an icon in a circle/disc.

Here is an example of what I have:

enter image description here

But I am struggling at placing the icon in the center of the circle/disc.

I have searched SO (found this post but changing the line-height only expands the disc/circle) & Google, looked at plenty of examples, but I cannot configure my CSS class code to center the icon.

Hoping that someone can suggest an answer.

Here is my html:

<div class="col-md-4 padding-bottom-10 visual_preview_standard" dir="ltr" style="direction: ltr; background-color: silver;">
    <div class="row">
        <span class="circle_icon" dir="ltr" style="direction: ltr;">
          <icon class="fa fa-graduation-cap" style="font-size: 70px;"></icon>
        </span>
    </div>
    <div class="row">
        <b>University Name</b>
    </div>
</div>

Here is my CSS class:

span.circle_icon {
    background: #fff;
    border-radius: 8em;
    -moz-border-radius: 8em;
    -webkit-border-radius: 8em;
    box-shadow:  0 0 0 6px #000;
    color: #000;
    display: inline-block;
    font-weight: bold;
    line-height: 10em;
    margin-bottom: 10px;
    margin-top: 10px;
    text-align: center;
    vertical-align: middle;
    width: 10em
}
Tamil Selvan C

just use

icon {
  vertical-align: middle;
 }

span.circle_icon {
    background: #fff;
    border-radius: 8em;
    -moz-border-radius: 8em;
    -webkit-border-radius: 8em;
    box-shadow:  0 0 0 6px #000;
    color: #000;
    display: inline-block;
    font-weight: bold;
    line-height: 10em;
    margin-bottom: 10px;
    margin-top: 10px;
    text-align: center;
    vertical-align: middle;
    width: 10em
}
icon {
  vertical-align: middle;
 }
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="col-md-4 padding-bottom-10 visual_preview_standard" dir="ltr" style="direction: ltr; background-color: silver;">
    <div class="row">
        <span class="circle_icon" dir="ltr" style="direction: ltr;">
          <icon class="fa fa-graduation-cap" style="font-size: 70px;"></icon>
        </span>
    </div>
    <div class="row">
        <b>University Name</b>
    </div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to center align ion icon inside button?

From Dev

Align icon vertically to the center of the first line of text

From Dev

Align icon to left and text to center in react native

From Dev

Align text and icon-font icon in span at center of parent div

From Java

How to align Big Icon at the center, inside smaller row in Flutter?

From Dev

How can I align my icon to be in center of my square box?

From Dev

social icon hover and center align the dropdown list in my menu bar

From Dev

Trying to align my icon font element at center is not working

From Dev

Icon cannot align to div center when use bootstrap.css

From Dev

How to align icon to the left and text to the center by using flex?

From Dev

How to align icon to the center in an <i> tag of fixed height

From Dev

Horizontal align center animated “X” icon in navbar-toggle (Bootstrap3)

From Dev

Icon aligns to center when using display: table and margin: auto, but when I change to display:none it does not align to center after .show()

From Dev

Align text center to the center of an image

From Dev

Align text center to the center of an image

From Dev

Align text to the icon

From Dev

css align text with icon with

From Dev

align text and icon CSS

From Dev

css align text with icon with

From Dev

align text and icon CSS

From Dev

Vaadin - Align icon on button

From Dev

Align vertically Icon and TextInput

From Dev

center align a section

From Dev

Button not center align in Safari

From Dev

Align center and right with flex?

From Dev

How to align Gridview center

From Dev

text align center not working

From Dev

How to center align circles?

From Dev

vertically center align <a> tag

Related Related

HotTag

Archive