How to I get the two columns to go beside each other. The first one will have text and the 2nd one will be a list. This is the header section and might have a background image. I'm using bootstrap v3.3.4, HTML5 and CSS3
I have attached an image of what I'm trying to accomplish.
<section id="about-us" class="about-us">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
</div>
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
</div>
</div>
</div>
</div>
</div>
</section>
CSS
.about-us {
background-size: cover;
background-attachment: scroll;
color: #fff;
position: relative;
background-position: center;
overflow: hidden;
height: 100vh;
}
.about-us h2 {
font-size: 650%;
font-weight: 400;
margin-bottom: 0px;
text-transform: uppercase;
color: #666;
}
.about-us .block {
position: relative;
padding: 340px 0px 0px;
z-index: 99;
text-align: center;
}
NEW CODE:
<section id="about-us" class="about-us">
<div class="container">
<div class="row">
<div class="col-md-3 col-md-offset-3 col-sm-3 col-sm-offset-3">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow- duration="900ms">
<h2>sample</h2>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-3">
<div class="block wow fadeInRight" data-wow-delay=".6s" data-wow-duration="900ms">
<h1>sample</h1>
<h1>sample</h1>
<h1>sample</h1>
<h1>sample</h1>
<h1>sample</h1>
<h1>sample</h1>
</div>
</div>
</div>
</div>
</div>
</section>
CSS
.about-us {
background-image:linear-gradient(rgba(18, 172, 234, 0.42), rgba(0, 191, 255, 0.55)),url(background-about-header.png);
background-size: cover;
background-attachment: scroll;
color: #fff;
position: relative;
background-position: center;
overflow: hidden;
height: 100vh;
}
#about-us h1 {
font-size: 400%;
font-weight: 400;
text-transform: none;
color: #fff;
text-align: justify;
margin: auto;
text-shadow: 2px 2px 1px rgba(56, 56, 56, 0.73);
}
.about-us h2 {
font-size: 750%;
font-weight: 400;
text-transform: uppercase;
color: #fff;
line-height: 80px;
padding-top: 70px;
padding-right: 20%;
margin: auto;
text-shadow: 3px 3px 2px rgba(56, 56, 56, 0.73);
}
#about-us .block {
position: relative;
padding: 205px 0px 0px;
text-align: center;
margin: auto;
}
Media Query
#about-us .block {
padding: 0px;
}
#about-us h1 {
text-align: justify;
margin-left: 20%
}
#about-us h2 {
padding-top: 150px;
padding-bottom: 30px;
margin-left: 10%
}
#media only screen and (max-width: 767px) {
.about-us h1,h2 {
font-size: 16px;
}
display:flex or display:table or display:inline-block can do this :
display:flex
.about-us h2 {
/*font-size: 650%;
font-weight: 400;*/
margin-bottom: 0px;
text-transform: uppercase;
color: #666;
margin:auto;
}
.row,.col-md-6 {
display:inline-flex;
align-items:center;
justify-content:center;
}
.col-md-6 {
flex:1;
padding:1em;
}
<section id="about-us" class="about-us">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
</div>
</div>
</div>
</div>
</div>
</section>
& display:table
.about-us h2 {
/*font-size: 650%;
font-weight: 400;*/
margin-bottom: 0px;
text-transform: uppercase;
color: #666;
margin:auto;
}
.row {
display:table;
table-layout:fixed;
}
.col-md-6 {display:table-cell;
vertical-align:middle;
text-align:center;
padding:1em;
}
<section id="about-us" class="about-us">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
</div>
</div>
</div>
</div>
</div>
</section>
& display:inline-block
.about-us h2 {
/*font-size: 650%;
font-weight: 400;*/
margin-bottom: 0px;
text-transform: uppercase;
color: #666;
margin: auto;
}
.col-md-6 {
display: inline-block;
vertical-align: middle;
text-align: center;
padding: 1em;
}
<section id="about-us" class="about-us">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="block wow fadeInRight" data-wow-delay=".3s" data-wow-duration="500ms">
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
<h2>WE ARE</h2>
</div>
</div>
</div>
</div>
</div>
</section>
Related
I developed a bootstrap card, inside that bootstrap card I am putting another one.
My problem is that when I reduce the screen size the text comes out of the card and also overlays the image, how can I solve this?
Demo
code
<div class="card-deck cardsZone">
<div class="card myCards">
<div class="card-body">
<div *ngFor="let pr of ProgressDashTasks">
<div class="card mysmallCcards">
<div class="card-body">
<div class="row">
<div class="col-sm-2">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgDash">
</div>
<div class="col-sm-8">
<span class="brandName">MY PERCENTAGE</span>
<p class="subtitledash">New percentage</p>
</div>
</div>
<hr class="solid">
<div class="row">
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
</div>
Card link
Another link
</div>
</div>
</div>
</div>
</div>
</div>
Image Problem
On .cardsZone you have to use a relative width and not an absolute one. Use width: fit-content:
.cardsZone{
margin-top: 5%;
width: fit-content;
height: 70%;
margin-right: auto;
margin-left: auto;
}
.myCards{
background: #E7EAF180 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
border: none;
}
.card-deck .card {
margin-left: 0px;
}
.mysmallCcards{
width: 100%;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
border: none;
margin-top: 20px;
}
.card-header:first-child {
border-radius: calc(9px - 1px) calc(9px - 1px) 0 0;
}
.mycardHeader{
background-color: white;
}
.imgDash{
width: 40px;
height: 40px;
border-radius: 8px;
}
.brandName{
text-align: left;
font-family: 'Noto Sans', sans-serif;
font-size: 22px;
letter-spacing: 0;
color: #4D4F5C;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 0px;
font-weight: re;
}
.subtitledash{
text-align: left;
font-family: 'Noto Sans', sans-serif;
font-size: 13px;
font-weight: bold;;
letter-spacing: 0;
color: #4D4F5C;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.imgusersDash{
width: 24px;
height: 24px;
transform: matrix(1, 0, 0, 1, 0, 0);
border-radius: 8px;
margin-left: 15px;
}
hr.solid {
border-top: 1px solid #999;
width:100%
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="card-deck cardsZone">
<div class="card myCards">
<div class="card-body">
<div *ngFor="let pr of ProgressDashTasks">
<div class="card mysmallCcards">
<div class="card-body">
<div class="row">
<div class="col-sm-2">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgDash">
</div>
<div class="col-sm-8">
<span class="brandName">MY PERCENTAGE</span>
<p class="subtitledash">New percentage</p>
</div>
</div>
<hr class="solid">
<div class="row">
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
</div>
Card link
Another link
</div>
</div>
</div>
</div>
</div>
</div>
Achieved
Want
as seen in the first picture the items are not properly aligned how can it be aligned like on the second picture? Here's the code I tried. Vertical-align attribute also doesn't seem to work, or may be i used it wrong.
.features{
background-color: #0375b4;
padding:40px 100px;
float: left;
width: 100%;
}
.features img{
width: auto;
}
.features-content{
text-align: center;
width: 100%;
display: inline-block;
margin:0 auto;
}
.features-content h1{
font-size: 24px;
color: #ffffff;
text-transform: uppercase;
margin-top: 10px;
}
<div class="features">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="features-content">
<img src="images/compass.png" alt="Compass Logo">
<h1>Adventure</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="features-content">
<img src="images/tube.png" alt="Compass Logo">
<h1>Fun & Safety</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="features-content">
<img src="images/diamond.png" alt="Compass Logo">
<h1>Impeccable Service</h1>
</div>
</div>
</div>
</div>
</div>
The problem is that your uploaded images are not the same height.
A. Make them the same either with CSS either before uploading them
See below example with changing height with css ( i changed the class col-xs-12 to col-xs-4 for example purposes only, so they will be 3 in row in the snippet )
.features {
background-color: #0375b4;
padding: 40px 100px;
float: left;
width: 100%;
}
.features img {
width: auto;
}
.features-content {
text-align: center;
width: 100%;
display: inline-block;
margin: 0 auto;
}
.features-content h1 {
font-size: 24px;
color: #ffffff;
text-transform: uppercase;
margin-top: 10px;
}
.features-content img{
height:150px;
width:auto;
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="features">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x150" alt="Compass Logo">
<h1>Adventure</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x250" alt="Compass Logo">
<h1>Fun & Safety</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x200" alt="Compass Logo">
<h1>Impeccable Service</h1>
</div>
</div>
</div>
</div>
</div>
B. Or you can make the cols same height an position the text absolutely at the bottom if you don't want to change the height of the images ( if you want your images to have different heights )
.features {
background-color: #0375b4;
padding: 40px 100px;
float: left;
width: 100%;
}
.features img {
width: auto;
max-width:100%;
}
.features-content {
text-align: center;
width: 100%;
display: inline-block;
margin: 0 auto;
}
.features-content h1 {
font-size: 24px;
color: #ffffff;
text-transform: uppercase;
margin-top: 10px;
}
.features .row {
display: flex;
flex-wrap: wrap;
}
.features .row > div {
position: relative;
padding-bottom: 60px;
border: 1px solid green;
/*for visual example*/
}
.features .row > div h1 {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin: 0 auto
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="features">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x150" alt="Compass Logo">
<h1>Adventure</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x250" alt="Compass Logo">
<h1>Fun & Safety</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x200" alt="Compass Logo">
<h1>Impeccable Service</h1>
</div>
</div>
</div>
</div>
</div>
C. The least 'clean' solution would be to add specific padding-bottom or margin-bottom to the images until the h1 are aligned. ( same with margin-top or padding-top to the h1 )
.features {
background-color: #0375b4;
padding: 40px 100px;
float: left;
width: 100%;
}
.features img {
width: auto;
max-width: 100%
}
.features-content {
text-align: center;
width: 100%;
display: inline-block;
margin: 0 auto;
}
.features-content h1 {
font-size: 24px;
color: #ffffff;
text-transform: uppercase;
margin-top: 10px;
}
.features .col-md-4:first-child img {
padding-bottom: 100px;
}
.features .col-md-4:last-child img {
padding-bottom: 50px;
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="features">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x150" alt="Compass Logo">
<h1>Adventure</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x250" alt="Compass Logo">
<h1>Fun & Safety</h1>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="features-content">
<img src="http://via.placeholder.com/150x200" alt="Compass Logo">
<h1>Impeccable Service</h1>
</div>
</div>
</div>
</div>
</div>
I'm new to CSS and HTML. My code is below. The footer hides a part from the last card. How do I fix this? I also want to know if this is the right way to implement this design or is there a better way?
my code:
http://plnkr.co/edit/iqoLHe46yxK335MsDknN?p=preview
<!DOCTYPE html>
<html>
<head>
<title>First</title>
<script src="jquery-3.1.1.min.js"></script>
<style>
#container{
width: 100%;
padding: 0 0 0 0%;
font-size: 0;
}
.container-header-menu{
position: fixed;
top: 0;
width: 100%;
height: 10%;
padding: 0 0 0 0%;
font-size: 0;
z-index: 10;
}
body {
margin:0px;
}
.header{
position: relative;
top: 0;
width: 100%;
background-color: #182538;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.header-left-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.header-right-text{
display: inline-block;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
font-size: 80%;
}
.menu{
display:inline-block;
position:relative;
top: 0;
width: 100%;
background-color: #1F2D48;
margin: 0px;
text-align: center;
font-size: 1rem;
}
.menu-text{
display: inline-block;
color: #FFFFFF;
text-align: left;
vertical-align: middle;
line-height: normal;
float: right;
padding-right: 2cm;
font-family: sans-serif;
}
.menu-item{
width:13%;
float:left;
padding-right: 12px;
}
.card-list{
position: relative;
top: 100px;
width:13%;
height:83%;
float:left;
padding-right: 12px;
overflow-y: auto;
z-index: 5;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 100%;
margin: 5px;
background-color: #F2F2F2;
z-index: 5;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.card-header{
background-color: #F2F2F2;
}
.card-container {
background-color: #FFFFFF;
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.card-container-header {
width: 100%;
position: relative;
margin: 0px;
text-align: center;
display:inline-block;
font-size: 1rem;
}
.footer{
position: fixed;
bottom: 0;
margin: 0px;
width: 100%;
height: 6%;
padding: 0 0 0 0%;
z-index: 100;
background-color: #1F2D48;
text-align: center;
}
.footer-left-text{
color: #FFFFFF;
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: left;
padding-left: 1cm;
font-family: sans-serif;
font-size: 80%;
}
.footer-right-button{
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: normal;
float: right;
font-family: sans-serif;
font-size: 100%;
background-color: #FFFFFF; /* Green */
border: none;
color: #1F2D48;
padding: 8px 32px;
border-radius: 8px;
margin: 4px;
border: 2px solid #1F2D48;
}
</style>
</head>
<body>
<div id="container">
<!-- header and menu bar container -->
<div class="container-header-menu">
<!-- header -->
<div class="header">
<p class="header-left-text"><strong>Lead Tracking:</strong> John Smith</p>
<p class="header-right-text">Monday, November 19, 2016</p>
</div>
<!-- menubar -->
<div class="menu">
<div class ="menu-item">
<p class="menu-text">Mapping</p>
</div>
<div class ="menu-item">
<p class="menu-text">Geology</p>
</div>
<div class ="menu-item">
<p class="menu-text">Engineering</p>
</div>
<div class ="menu-item">
<p class="menu-text">Negotiating</p>
</div>
<div class ="menu-item">
<p class="menu-text">Deal</p>
</div>
<div class ="menu-item">
<p class="menu-text">Rejected</p>
</div>
<div class ="menu-item">
<p class="menu-text">Pass</p>
</div>
</div>
</div>
<!-- card list for mapping-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
</div>
<!-- card list for engineering-->
<div class="card-list">
<div class="card">
<div class="card-container-header">
<h1 style="color:orange; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
<hr>
<div class="card">
<div class="card-container-header">
<h1 style="color:red; text-align:left;"><b>74</b></h1>
<h3 style="text-align:left;"><b>#1213-2324</b></h3>
</div>
<div class="card-container">
<h4><b>John Doe</b></h4>
<p>Architect & Engineer</p>
</div>
</div>
</div>
</div>
<div class="footer">
<p class="footer-left-text"><strong>Footer</strong></p>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">status</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">map</button>
<button type="button" class="footer-right-button" onclick="alert('Hello world!')">details</button>
</div>
</body>
</html>
Pastie Link
You can fix it by adding margin-bottom to class .card-list and it must be equals to the height of your footer.
so just add margin-bottom:6%;since 6% is the height of your footer.
You can add to your .card-list css;
margin-bottom:100px;
This provides a margin for the bottom of the area, so it doesn't overlap with any other elements.
Hope it helps!
Edit*
Chillers' answer is much better compared to mine, as it compensates for scaling between resolutions and devices.
This question already has answers here:
How do I vertically center text with CSS? [duplicate]
(37 answers)
Closed 6 years ago.
I am styling steps 1,2,3 for my landing page. I use the bootstrap framework in this case.
What I want is just move text for step 1 and step 3 down a little bit but leave step 2 as normal.
.steps:.step:first-child:last-child h5 {
margin-top: 25px;
}
.step {
padding-left: 130px;
padding-top: 12px;
padding-bottom: 25px;
background-color: black;
height: 110px;
border: 2px solid #62a9af;
border-radius: 60px 0px;
}
.step .number {
position: absolute;
top: 14px;
left: 25px;
font-family: "Oswald", sans-serif;
color: #ffbe01;
font-size: 4em;
line-height: 1.4em;
text-align: center;
width: 1.5em;
height: 1.5em;
background-color: rgba(98, 169, 175, 0.25);
border-radius: 50%;
}
.step h5 {
font-family: "Oswald", sans-serif;
font-size: 2em;
color: white;
font-weight: 500;
text-transform: uppercase;
}
.steps {
margin-top: 10px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<section class="steps">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">1</div>
<h5>REGÍSTRATE</h5>
<p></p>
</div>
</div>
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">2</div>
<h5>SIGUE LAS INSTRUCCIONES</h5>
<p></p>
</div>
</div>
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">3</div>
<h5>¡JUEGA!</h5>
<p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
My Codepen
I don't think that's the best way to solve the problem you're facing, I think you should use flexbox, it's a lot more responsive. Here's my code.
* {
font-family: Oswald, sans-serif;
}
.step {
background-color: #000;
height: 110px;
border: 2px solid #62a9af;
border-radius: 60px 0;
display: flex;
align-items: center;
}
.step .number {
color: #ffbe01;
font-size: 4em;
line-height: 1.4em;
text-align: center;
width: 1.5em;
height: 1.5em;
background-color: rgba(98, 169, 175, .25);
border-radius: 50%;
margin: 15px;
}
.step h5 {
font-size: 2em;
color: #fff;
font-weight: 500;
text-transform: uppercase;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<section class="steps">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">1</div>
<h5>REGÍSTRATE</h5>
<p></p>
</div>
</div>
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">2</div>
<h5>SIGUE LAS INSTRUCCIONES</h5>
<p></p>
</div>
</div>
<div class="col-xs-12 col-sm-offset-3 col-sm-7 col-md-offset-0 col-md-4">
<div class="step">
<div class="number">3</div>
<h5>¡JUEGA!</h5>
<p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
I've simplified your CSS a little, and also changed how your number is added. You'll notice display: flex; and align-items: center; are now in .step this means everything inside .step is vertically central.
Now the text in each step will look central no matter how many lines they take up.
I hope this helps.
Just add an id for the 2 steps:
HTML:
<h5 id="heightdown">REGÍSTRATE</h5>
<h5 id="heightdown">¡JUEGA!</h5>
CSS:
#heightdown {
padding-top: 5px;
}
On left side you see my current state, on the right side I have used a image-editing programm to show how I want that the tiles looks like. I have tried a bit, but every time when I tried to add for example the "xxx" text, the whole tile has been moved up. I would appreciate it, when someone could solve it for me.
.main {
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
background-color: #AAAAAA;
}
.main .inner {
padding: 5px;
font-size: 0px;
display: table;
margin-left: auto;
margin-right: auto;
}
.main .inner:hover {
opacity: 0.8;
background-color: #2e8bcc;
}
.tile h2 {
font-size: 20px;
color: #FFF;
font-family: "Helvetica Neue", sans-serif;
font-weight: 100;
line-height: 1.1;
text-align: center;
}
.tile {
margin: 0px;
padding: 0px;
height: 190px;
width: 190px;
border: 5px solid #AAAAAA;
opacity: 8;
background-color: #2980b9;
display: inline-block;
}
.body {
background-color: #AAAAAA;
}
<div class="main">
<div class="inner">
<div class="tile">
<h2>Name 1</h2>
</div>
<div class="tile">
<h2>Name 2</h2>
</div>
<div class="tile">
<h2>Name 3</h2>
</div>
<div class="tile">
<h2>Name 4</h2>
</div>
<div class="tile">
<h2>Name 5</h2>
</div>
<div class="tile">
<h2>Name 6</h2>
</div>
<div class="tile">
<h2>Name 6</h2>
</div>
<div class="tile">
<h2>Name 7</h2>
</div>
</div>
</div>
I don't see any problem with your code. I've only added
.tile {
font-size: 16px;
color: #fff;
text-align: center;
}
.main {
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
background-color: #AAAAAA;
}
.main .inner {
padding: 5px;
font-size: 0px;
display: table;
margin-left: auto;
margin-right: auto;
}
.main .inner:hover {
opacity: 0.8;
background-color: #2e8bcc;
}
.tile h2 {
font-size: 20px;
color: #FFF;
font-family: "Helvetica Neue", sans-serif;
font-weight: 100;
line-height: 1.1;
text-align: center;
}
.tile {
margin: 0px;
padding: 0px;
height: 190px;
width: 190px;
border: 5px solid #AAAAAA;
opacity: 8;
background-color: #2980b9;
display: inline-block;
font-size: 16px;
color: #fff;
text-align: center;
}
.body {
background-color: #AAAAAA;
}
<div class="main">
<div class="inner">
<div class="tile">
<h2>Name 1</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 2</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 3</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 4</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 5</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 6</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 6</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
<div class="tile">
<h2>Name 7</h2>
<img src="http://placehold.it/100x100">
<div>xxxxx</div>
</div>
</div>
</div>
Just add float:left to .tile div and it will work fine
.main {
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
background-color: #AAAAAA;
}
.main .inner {
padding: 5px;
font-size: 0px;
display: table;
margin-left: auto;
margin-right: auto;
}
.main .inner:hover {
opacity: 0.8;
background-color: #2e8bcc;
}
.tile h2 {
font-size: 20px;
color: #FFF;
font-family: "Helvetica Neue", sans-serif;
font-weight: 100;
line-height: 1.1;
text-align: center;
}
.tile {
float:left;
margin: 0px;
padding: 0px;
height: 190px;
width: 190px;
border: 5px solid #AAAAAA;
opacity: 8;
background-color: #2980b9;
display: inline-block;
}
.body {
background-color: #AAAAAA;
}
<div class="main">
<div class="inner">
<div class="tile">
<h2>Name 1</h2>
<h4>xxxxxx</h>
</div>
<div class="tile">
<h2>Name 2</h2>
</div>
<div class="tile">
<h2>Name 3</h2>
</div>
<div class="tile">
<h2>Name 4</h2>
</div>
<div class="tile">
<h2>Name 5</h2>
</div>
<div class="tile">
<h2>Name 6</h2>
</div>
<div class="tile">
<h2>Name 6</h2>
</div>
<div class="tile">
<h2>Name 7</h2>
</div>
</div>
</div>