How to align text and :before icon vertically center? [duplicate] - html

This question already has answers here:
Flexbox: center horizontally and vertically
(14 answers)
How can I vertically align elements in a div?
(28 answers)
Closed 10 months ago.
I'm trying to vertically center icon and text in a background, but I guess I'm doing something wrong. The dot before the text is not perfectly centered with the background. Why is this happening ?
Is there a better way to do this ? Sorry but I'm new.
.status {
display: inline;
}
.success {
font-family: roboto;
color: #27ae60;
background: #e1e1e1;
border-radius: 50px;
padding: 0px 50px 0px 50px;
font-size: 38px;
}
.success:before {
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
vertical-align: middle;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" rel="stylesheet">
<div class="status success">Purchuased</div>

You can use a flexbox or grid to center the text en icon perfectly.
Below an example using flexbox.
.status {
/* Added */
display: flex;
align-items: center;
}
.success {
font-family: roboto;
color: #27ae60;
background: #e1e1e1;
border-radius: 50px;
padding: 0px 50px 0px 50px;
font-size: 38px;
}
.success:before {
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
/* vertical-align: middle; Removed */
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" rel="stylesheet">
<div class="status success">Purchuased</div>

The best way would be to utilise flexbox:
CSS:
.status {
display: inline-flex; // flex or inline-flex here
}
.success:before {
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
align-self: center; // use this instead of vertical-align: middle;
}

if its just 1 line of code You can simply add center tag to align both of them in the middle, inline-flex then align-items center to be vertically align Let me know if this is what you mean.
.status {
display: inline-flex;
align-items:center;
}
.success {
font-family: roboto;
color: #27ae60;
background: #e1e1e1;
border-radius: 50px;
padding: 0px 50px 0px 50px;
font-size: 38px;
}
.success:before {
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
vertical-align: middle;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" rel="stylesheet">
<center><div class="status success">Purchased</div></center>

.status {
display: inline;
}
.success {
font-family: roboto;
color: #27ae60;
background: #e1e1e1;
border-radius: 50px;
padding: 0px 50px 0px 50px;
font-size: 38px;
}
.success:before {
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
vertical-align: 10px;
}

this worked for me
.status {
display: inline;
position: relative;
}
.success {
font-family: roboto;
color: #27ae60;
background: #e1e1e1;
border-radius: 50px;
padding: 0px 50px 0px 50px;
font-size: 38px;
}
.success:before {
position: absolute;
font-family: FontAwesome;
content: "\f111";
font-size: 10px;
margin-right: 16px;
color: #27ae60;
transform: translate(-25px, 21px);
}

Related

How to not move images around and push elements when browser is resizing

This is my HTML and CSS code. If you run this, there will be a image of a macbook and a 'buy' button. When the browser is minimised, the image is alittle off from the center. When it is in full screen, it causes the image to move up and the 'buy' button gets pushed to the bottom. I tried to use position: fixed but it didnt work. How do you make the picture have fixed position in the middle
.new {
font-family: Arial;
color: rgb(202, 137, 15);
font-size: 18px;
margin-bottom: 15px;
}
.macbook {
font-family: Arial;
font-weight: bold;
font-size: 44px;
margin-top: 0px;
margin-bottom: 10px;
}
.supercharged {
font-family: Arial;
font-weight: bold;
font-size: 60px;
margin-top: 0px;
margin-bottom: 25px;
}
.price {
font-family: Arial;
font-size: 18px;
margin-top: 0px;
}
.button {
background-color: #007aff;
color: white;
border-radius: 100px;
font-weight: bold;
border: none;
padding-left: 16px;
padding-right: 16px;
padding-bottom: 10px;
padding-top: 10px;
position: 50px;
}
.button:hover {
opacity: 0.8;
}
.button:active {
opacity: 0.5;
}
.charged {
color: plum;
text-decoration: underline;
}
.picture {
margin-top: 50px;
}
<!DOCTYPE html>
<html align='center'>
<body>
<p class='new'>New</p>
<h2 class='macbook'>MacBook Pro</h3>
<h1 class='supercharged'><span class='charged'>Supercharged</span> for pros.</h1>
<p class='price'>From $1999</p>
<button class='button'>Buy</button>
<img src="https://images.macrumors.com/t/PV_LL2AlRJvaRvbuXCTUOuDpwzU=/800x0/smart/article-new/2013/09/16-inch-macbook-pro.jpg?lossy" alt="Macbook" class='picture'>
</body>
</html>
Just apply display: block to the <a>-element. When you use display: block on an element, it will try to take up as much width as possible. Seeing as it is not inside a parent container, it will take up 100% width of the <body>-element, as that is the elements closest parent. This way, it won't wrap around the image. The link will however stretch and fill the entire parent container as well. To combat this, apply max-width: fit-content, so the link's width is only relative to its content. Then you can apply margin: auto to center the element again.
For a responsive image, apply max-width: 100% and height: auto. This way it will automatically scale down, as the max-width: 100% property won't let it overflow its parent container (the <body>-element)
body {
text-align: center;
}
.new {
font-family: Arial;
color: rgb(202, 137, 15);
font-size: 18px;
margin-bottom: 15px;
}
.macbook {
font-family: Arial;
font-weight: bold;
font-size: 44px;
margin-top: 0px;
margin-bottom: 10px;
}
.supercharged {
font-family: Arial;
font-weight: bold;
font-size: 60px;
margin-top: 0px;
margin-bottom: 25px;
}
.price {
font-family: Arial;
font-size: 18px;
margin-top: 0px;
}
.button {
background-color: #007aff;
color: white;
border-radius: 100px;
font-weight: bold;
border: none;
padding-left: 16px;
padding-right: 16px;
padding-bottom: 10px;
padding-top: 10px;
position: 50px;
}
.button:hover {
opacity: 0.8;
}
.button:active {
opacity: 0.5;
}
.charged {
color: plum;
text-decoration: underline;
}
.picture {
margin-top: 50px;
max-width: 100%;
height: auto;
}
a {
display: block;
max-width: fit-content;
margin: auto;
}
<p class='new'>New</p>
<h2 class='macbook'>MacBook Pro</h3>
<h1 class='supercharged'><span class='charged'>Supercharged</span> for pros.</h1>
<p class='price'>From $1999</p>
<button class='button'>Buy</button>
<img src="https://images.macrumors.com/t/PV_LL2AlRJvaRvbuXCTUOuDpwzU=/800x0/smart/article-new/2013/09/16-inch-macbook-pro.jpg?lossy" alt="Macbook" class='picture'>
By default an image is displayed inline, which is causing your issue. You're on the right track, but instead of position fixed, position: block; would be a better choice.
(You can also centre your image and avoid it overflowing using a max-width and some margin)
.new {
font-family: Arial;
color: rgb(202, 137, 15);
font-size: 18px;
margin-bottom: 15px;
}
.macbook {
font-family: Arial;
font-weight: bold;
font-size: 44px;
margin-top: 0px;
margin-bottom: 10px;
}
.supercharged {
font-family: Arial;
font-weight: bold;
font-size: 60px;
margin-top: 0px;
margin-bottom: 25px;
}
.price {
font-family: Arial;
font-size: 18px;
margin-top: 0px;
}
.button {
background-color: #007aff;
color: white;
border-radius: 100px;
font-weight: bold;
border: none;
padding-left: 16px;
padding-right: 16px;
padding-bottom: 10px;
padding-top: 10px;
position: 50px;
}
.button:hover {
opacity: 0.8;
}
.button:active {
opacity: 0.5;
}
.charged {
color: plum;
text-decoration: underline;
}
.picture {
margin: 50px auto 0 auto;
display: block;
max-width: 100%;
}
<!DOCTYPE html>
<html align='center'>
<body>
<p class='new'>New</p>
<h2 class='macbook'>MacBook Pro</h3>
<h1 class='supercharged'><span class='charged'>Supercharged</span> for pros.</h1>
<p class='price'>From $1999</p>
<button class='button'>Buy</button>
<img src="https://images.macrumors.com/t/PV_LL2AlRJvaRvbuXCTUOuDpwzU=/800x0/smart/article-new/2013/09/16-inch-macbook-pro.jpg?lossy" alt="Macbook" class='picture'>
</body>
</html>

how to add right border before icon in button

I want to add a border in the button before the icon
what I m using is that
my code is this
.button {
background-color: #4CAF50;
border: none;
color: white;
Width: 660px;
Height:55px;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
background: #333333;
position: absolute;
left: 16.76%;
right: 16.68%;
top: 27.29%;
bottom: 30.89%;
font-family: DIN Pro;
font-style: normal;
font-weight: bold;
font-size: 18px;
line-height: 23px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
Contact<span style="border:solid 1px white"><i class="fa fa-home;"></span></i>
</body>
</html>
but it is not setting up like that. I want to set it up like the same is in the picture
Here is the code you need for the button. To answer your question about the border on the icon, I added a pseudo element (:after) to the button which contains the arrow icon. Then it was just a matter of applying border-left to it.
/* button styles */
.button {
background-color: slategray;
font-family: sans-serif;
border: none;
outline: none;
min-height: 42px;
min-width: 180px;
max-width: 100%;
font-weight: bold;
text-decoration: none;
cursor: pointer;
font-size: 18px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
display: inline-flex;
justify-content: center;
align-items: center;
padding: 8px 52px 8px 10px;
position: relative;
}
.button:after {
content: "\f061";
display: flex;
position: absolute;
font-family: "Font Awesome 5 Free", sans-serif;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
width: 42px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
border-left: 1px solid #8192a2;
}
.button:hover {
background-color: #8192a2;
}
.button:hover:after {
border-left-color: #95a7b8;
}
/* example styles */
body,
html {
padding: 0;
margin: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: coral;
}
* {
box-sizing: border-box;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
Contact

Vertically center text next to a custom checbox? [duplicate]

This question already has answers here:
How do I vertically align text in a div?
(34 answers)
Closed 2 years ago.
I have found a few posts related to this subject, but no answers seem to be working in my scenario, I am assuming due to my custom class for the checkbox.
Essentially I just want the text next to the checkbox to always vertically align with it, but the vertical alignment behavior is different based on whether the checkbox is checked or not.
I have made the font-size, height, and line-height equivalent for the text and checkbox, which seems to not have made a difference. I have also tried content: "\200b"; in the css but that also seems to not make a difference.
Also, I am unable to use "newer" html/css things because this is for an application that uses an older version of html/css before flexbox.
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 22px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 22px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div>
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
You could use flexbox. In the snippet, I added a class of checkbox-wrapper to allow for targeting the div, and used align-items to center it.
.checkbox-wrapper {
display:flex;
align-items:center;
}
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
font-size: 30px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 30px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 9px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div class="checkbox-wrapper">
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
Additionally, you could position the .lvl1Name if flex isn't an option. For that class, add a position:relative and a negative top value:
.lvl1Name {
position:relative;
top:-7px;
line-height: 22px;
height: 22px;
font-size: 22px;
}
In your case, with the same font-size, line-height and height just add vertical-align: bottom; to the checkbox.
.lvl1Name {
font-size: 22px;
}
.checkboxBig {
vertical-align: bottom;
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 22px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 22px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div>
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
Please try using position: absolute and top property on .lvlName class and set position: realtive property on the parent element.
position property sets how an element is positioned in a document.
For more about position property see mdn
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
position: absolute;
top: 5px;
}
.main-div {
position: relative;
}
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
position: absolute;
top: 5px;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 22px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 22px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
.main-div {
position: relative;
}
<div class="main-div">
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
You can add a class to the div containing both the elements and use flex box css.
.container{
display: flex;
align-items: center;
}
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
font-size: 30px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 30px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 9px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div class="container">
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
If flex box is not something that you are looking for, then you can use vertical-align.
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
vertical-align: middle;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
font-size: 30px;
padding-left: 1px;
text-align: center;
vertical-align: middle;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 30px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 9px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div>
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>
Try using the display:flex in the div. Using flexbox usually helps to solve a lot of problems like this.

vertically center text with difference sizes

I'm trying to create a match div, which show match information. However they should all be different sizes and it does not seem like it wants to center properly. I want all these text to be centered in the middle of the div? how can this be done?
.saperator {
margin-right: 17px;
vertical-align: text-bottom;
color: #787878;
}
.result-in-month {
padding: 25px 20px;
background: #efefef;
margin-bottom: 10px;
border-radius: 4px;
border: none;
transition: all 0.45s ease-in-out 0s;
position: relative;
}
.result-in-month:hover {
background: #FFF;
box-shadow: 0px 0px 3px 1px #e5e5e5;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.result-date {
display: inline-block;
width: 12%;
margin-right: 2%;
font-size: 12px;
font-weight: 400;
text-transform: uppercase;
line-height: 40px;
}
.result-stream {
display: inline-block;
width: 12%;
text-transform: uppercase;
line-height: 40px;
text-align: right;
color: #212121;
font-size: 36px;
}
.result-stream a:hover {
text-decoration: none;
}
.result-match-team-wrapper {
display: inline-block;
width: 72%;
text-align: center;
text-transform: uppercase;
line-height: 40px;
font-weight: normal;
font-size: 18px;
}
.result-match-versus {
padding: 0px 3px;
font-weight: normal;
color: #999999;
}
.result-match-team.left {
margin-right: 2.5%;
text-align: right;
}
.result-match-team.right {
margin-left: 2.5%;
text-align: left;
}
.result-match-team {
display: inline-block;
width: 40%;
}
.result-match-separator {
margin: 0px 2.5%;
}
#nav {
margin-left:0px !important;
}
#nav li {
display: inline-block;
padding: 4px 11px;
background-color: #fff;
margin-right: 6px;
}
#nav li a {
color: #000;
text-decoration: none;
text-transform: uppercase;
font-size: 18px;
font-weight: 400;
font-family: Oswald, Impact, sans-serif !important;
}
#nav li.active {
background-color: #000;
}
#nav li.active a {
color: #fff;
}
<div class="result-in-month">
<div class="result-date">
SLUT
</div>
<div class="result-match-team-wrapper">
<span class="result-match-team left">
TEAM 3
</span>
<span class="result-match-versus">
VS
</span>
<span class="result-match-team right">
TEAM 1
</span>
</div>
<div class="result-stream">
<span class="result-match-score" >2</span><span class="result-match-separator">-</span><span class="result-match-score">1</span>
</div>
<div class="clear"></div>
</div>
You could let the inner divs behave like table cells and then vertical align them.
div {
border: 1px solid grey;
}
.match-header {
display: table;
width: 100%;
height: 300px;
}
.v-center {
vertical-align: middle;
display: table-cell;
}
.player-a {
font-size: 3em;
text-align: center;
}
.player-b {
font-size: 6em;
text-align: center;
}
.score {
font-size: 1em;
text-align: center;
}
<div class="match-header">
<div class="player-a v-center">
Ann
</div>
<div class="score v-center">
5 vs 6
</div>
<div class="player-b v-center">
Bob
</div>
</div>
I would probably change the structure of your HTML but this should see you on the right track with what you've got.
Updated fiddle
You can use absolute positioning on the children elements of your result-in-month class like so
.result-date{
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 12%;
margin-right: 2%;
font-size: 12px;
font-weight: 400;
text-transform: uppercase;
}
.result-match-team-wrapper {
position: absolute;
top: 50%;
transform: translateY(-50%);
display: inline-block;
width: 94%;
text-align: center;
text-transform: uppercase;
line-height: 40px;
font-weight: normal;
font-size: 18px;
}
.result-stream{
position: absolute;
top: 50%;
right: 5%;
transform: translateY(-50%);
display: inline-block;
width: 12%;
text-transform: uppercase;
line-height: 40px;
text-align: right;
color: #212121;
font-size: 36px;
}
Do you mean something like this ?
https://jsfiddle.net/wgrLfxg3/4/
Because you are using elements you only declared the font and size in nav but not the rest of elements
add the follow to the other elements and it will work fine. Take a look to the fiddle
font-size: 18px;
font-weight: 400;
font-family: Oswald, Impact, sans-serif !important;

Why isn't this text centering vertically / horizontally?

I'm trying to center this text horizontally and vertically, ideally based on percentages (for responsive-ness). I can't figure out why this isn't working.
Fiddle: http://jsfiddle.net/PTSkR/144/
Code:
<div class="row-fluid card-box">
<div class="span2 card-box-controls-container">
<div class="card-box-controls">
<a >edit</a>
<a >delete</a>
</div>
</div>
</div>
.card-box .card-box-controls-container {
height: 160px;
vertical-align: middle;
display: inline-block;
text-align: center;
color: black;
font-size: 14px !important;
}
.card-box .card-box-controls-container .card-box-controls {
vertical-align: middle;
display: inline-block;
text-align: center;
color: black;
font-size: 14px;
}
.card-box .card-box-controls a {
cursor: pointer !important;
color: gray;
text-decoration: none;
margin: 0;
vertical-align: middle;
font-size: 14px;
}
.card-box {
background-color: #f5f5f5;
color: black;
margin-right: 0px;
margin-bottom: 15px;
margin-top: 15px;
padding: 5px 0 5px 0;
}
You can use display:table, for example:
.card-box .card-box-controls-container {
height: 160px;
vertical-align: middle;
display:table;
text-align: center;
color: black;
font-size: 14px !important;
width: 100%;
}
.card-box .card-box-controls-container .card-box-controls {
vertical-align: middle;
display: table-cell;
text-align: center;
color: black;
font-size: 14px;
}
.card-box .card-box-controls a {
cursor: pointer !important;
color: gray;
text-decoration: none;
margin: 0;
vertical-align: middle;
font-size: 14px;
}
.card-box {
background-color: #f5f5f5;
color: black;
margin-right: 0px;
margin-bottom: 15px;
margin-top: 15px;
padding: 5px 0 5px 0;
}
pls view the demo. and you can use display:inline-block, for example:
.card-box .card-box-controls-container {
height: 160px;
text-align: center;
color: black;
font-size: 14px !important;
}
.card-box .card-box-controls-container:after{
content:"";
display: inline-block;
height: 100%;
vertical-align: middle;
width: 0px;
background: red;
}
.card-box .card-box-controls-container .card-box-controls {
vertical-align: middle;
display: inline-block;
text-align: center;
color: black;
font-size: 14px;
position: relative;
}
.card-box .card-box-controls a {
cursor: pointer !important;
color: gray;
text-decoration: none;
margin: 0;
vertical-align: middle;
font-size: 14px;
}
.card-box {
background-color: #f5f5f5;
color: black;
margin-right: 0px;
margin-bottom: 15px;
margin-top: 15px;
padding: 5px 0 5px 0;
}
pls view the demo.
There are other ways, pls click here and here.
You can use line-height: 160px on .card-box .card-box-controls-container if you want to center only one line.
http://jsfiddle.net/PTSkR/146/
There's no easy way to vertically align content in html or css more info #
http://blog.themeforest.net/tutorials/vertical-centering-with-css/