I've looked at this answer and a few similar ones, but still struggling with alignment.
I have 3 divs in a parent div. Each div has a font-awesome icon and text.
Currently the alignment is spaced evenly horizontally, but with gaps between text and icons. I need each div's text next to the icon.
What I have:
[ icon text icon text icon text ]
What I need:
[ icon text icon text icon text ]
Code:
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
/*display: inline-block; */
}
.block1 {
/* float: left;*/
}
.block2 {
/*display:inline-block;*/
}
.block3 {
/*float: right;*/
}
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4 question-block block1">
<div class="pull-left"><i class="fa fa-group fa-fw fa-3x question-icon"></i>
</div>
<h4>My first text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block2">
<a class="pull-left" href="#">
<i class="fa fa-question fa-fw fa-3x question-icon"></i>
</a>
<h4 class="">My second text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block3">
<div class="pull-left"><i class="fa fa-graduation-cap fa-fw fa-3x question-icon"></i>
</div>
<h4>My third text</h4>
</div>
</div>
</div>
</div>
</div>
I've tried:
adding float left and right to the two divs on the ends and switching the html around so the floats are first and then the centre. Didn't work.
If I remove the text-align: center css property from the .question-line then the text is against the icons how it should be, but everything is then left aligned in the parent div and not centered. I get this then:
[ icon text icon text icon text ]
I've tried display: table-cell on the icons and the h4. also not working.
I made a few changes in your code, see code bellow :
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
/*display: inline-block; */
}
.block1 {
/* float: left;*/
}
.inline-block {
display: inline-block;
}
.block3 {
/*float: right;*/
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4">
<i class="fa fa-group fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My first text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 ">
<i class="fa fa-question fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My second text</h4>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 ">
<i class="fa fa-graduation-cap fa-fw fa-3x question-icon"></i>
<h4 class="inline-block">My third text</h4>
</div>
</div>
</div>
</div>
</div>
Here is updated code. text-align did the trick. Check in "full page" mode to see the effect. http://i.imgur.com/KAYkTMp.png
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
width: 100%;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: center;
}
.question-block {
margin: 10px 0 30px;
vertical-align: middle;
white-space: nowrap;
}
.block1 {
/* float: left;*/
}
.block2 {
/*display:inline-block;*/
}
.block3 {
/*float: right;*/
}
<div class="container">
<div class="row">
<div class="question-instructions">
<div class="row text-center">
<div class="col-lg-12 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 ">
<h2>MY TITLE</h2>
</div>
</div>
<div class="row question-line">
<div class="col-lg-4 col-md-4 col-sm-4 question-block block1">
<div style="display: inline-block;">
<i class="fa fa-group fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My first text</h4>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block2">
<div style="display: inline-block;">
<i class="fa fa-question fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My second text</h4>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 question-block block3">
<div style="display: inline-block;">
<i class="fa fa-graduation-cap fa-fw fa-3x question-icon pull-left"></i>
<h4 class="pull-left">My third text</h4>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
Check this fiddle.
CSS
.question-instructions {
background-color: #3eb6a9;
margin: 0px 0px 0px;
}
.question-line {
margin: 0px auto;
white-space: nowrap;
text-align: left;
}
.question-block {
margin: 10px 0 30px;
align-content: center;
vertical-align: middle;
}
.question-block h4{
display: inline-block;
}
.block {
float: left;
}
Related
I have a horizontal scrollable div where I have squared divs. I need to make these squared divs bigger, but I can't achieve this. In the example I provide here, there are 3 squared divs. Each time I add a new one, all of them get even smaller. How can I prevent them from shrinking and maintain my scrollable div?
Here's my codepen.
Set a min-width to your boxes, and make sure your container doesn't wrap.
Modified code is in the bottom of the CSS snippet
.publish-product-form {
margin-bottom: 15px;
}
.image-scroller {
border: 1px solid blue;
width: 375px;
height: auto;
white-space: nowrap;
position: relative;
overflow-x: scroll;
overflow-y: hidden;
background-color: white;
padding: 0px;
-webkit-overflow-scrolling: touch;
}
.img-box {
padding: 0px;
}
.img-holder {
margin-top: 20px;
}
.image-doesnt-exist {
width: 100%;
padding-bottom: 100%;
background-size: cover;
background-position: center;
border: 2px dotted #8ABE57;
border-radius: 0.25rem;
}
.add-img-button::before {
font-size: 1.2em;
}
.add-img-button {
color: #8ABE57;
position: absolute;
top: 50%;
left: 50%;
font-size: 1.2em;
transform: translate(-50%, -50%);
}
.add-img-button:hover {
color: #9FD362;
}
/**New css**/
.image-scroller .row {
flex-wrap: nowrap;
}
.image-scroller .img-box {
min-width: 180px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.4.3/umd/popper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-alpha1/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" />
<button class="btn btn-primary" type="button" data-toggle="modal" data-target="#editProductModal">Click me</button>
<!-- Modal Editar Aviso -->
<div class="modal fade bd-example-modal-md publish-product-modal" tabindex="-1" role="dialog"
aria-labelledby="myLargeModalLabel" aria-hidden="true" id="editProductModal">
<div class="modal-dialog modal-md modal-dialog-centered" role="document">
<div class="modal-content publish-product-modal-content">
<div class="modal-header publish-product-modal-header">
<img src="images/logo-header.svg">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body publish-product-modal-body text-center col-lg-11 col-md-11 pb-5 pt-0 mx-auto">
<!-- Image Edition Section -->
<div class="publish-product-form col-12">
<form class="edit-ad-product-information">
<!--- MY IMAGE SCROLL TEST -->
<div class="row">
<div class="image-scroller col-12">
<div class="row">
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
<div class="img-box col">
<div class="col-12 img-holder">
<a href="#">
<i class="fas fa-camera add-img-button"></i>
<div class="image-doesnt-exist"></div>
</a>
</div>
</div>
</div>
</div>
</div>
<!-- /MY IMAGE SCROLL TEST-->
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /Modal Editar Aviso-->
remove col class from div.img-box,
also you need to change .row class' display property to block from flex
.row {
display: block;
white-space: nowrap
}
.img-box {
height: 125px;
width: 125px;
display: inline-block;
}
I am trying to align the text and icons, which are in a box, to the center of it. I want it centered like this:
I tried the following:
adding align-content: center and justify-content: center as an inline style in the div tag for row, but no luck. Any helps or leads are appreciated. I have provided a jsfiddle link to show you what I have now. As of now, all the content is left.
https://jsfiddle.net/silosc/76ktyveu/4/
<div class="row" style="width:100%">
<div class="report-card-i report-card-i-height">
<h3 class="m-l-35 p-t-25 p-b-10">Stats</h3>
<div class="fa-orange m-t-10 m-b-15">
<div class="row">
<div class="col-sm-3 col-xs-3">
<i class="fa fa-star m-r-15">Stat1</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-3 col-xs-3">
<i class="fa fa-star m-r-15">Stat2</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-3 col-xs-3">
<i class="fa fa-star m-r-15">Stat3</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
</div>
</div>
<style>
.report-card-i{
background: orange;
box-shadow: 2px 2px 10px 4px rgba(0, 0, 0, 0.2);
position: relative;
margin-top: 30px;
}
.report-card-i-height {
min-height: 280px;
height: auto;
width: 100%;
}
.report-name {
font-family: Questrial;
font-weight: bold;
color: #f0522f !important;
}
</style>
Since you are using bootstrap you can use the text-left class. Also a lot of your bootstrap margins and padding classes are set wrong... margins are mr-1 to mr-5. Same format for paddings
.report-card-i {
background: orange;
box-shadow: 2px 2px 10px 4px rgba(0, 0, 0, 0.2);
position: relative;
margin-top: 30px;
}
.report-card-i-height {
min-height: 280px;
height: auto;
width: 100%;
}
.report-name {
font-family: Questrial;
font-weight: bold;
color: #f0522f !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="row" style="width:100%">
<div class="report-card-i report-card-i-height">
<h3 class="ml-5 pt-5 pb-2">Stats</h3>
<div class="fa-orange mt-5 mb-5">
<div class="row">
<div class="col-sm-3 col-xs-3 text-center">
<i class="fa fa-star">Stat1</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-3 col-xs-3 text-center">
<i class="fa fa-star m-r-15">Stat2</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-3 col-xs-3 text-center">
<i class="fa fa-star m-r-15">Stat3</i>
</div>
<div class="col-sm-2 col-xs-3">
<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
</div>
</div>
Try this: .fa { margin-left: 50%; transform: translateX(-50%); },
and if you want space between the icon and the text then try: .fa-star:before { padding-right: 20px; }
I am having some trouble with some of my bootstrap cards overlapping my navbar. I made sure that none of my positions were absolute and that the z indexes were handled properly, but I still get the same issue. doing padding-top on the body did not give me the result I wanted either. Here are some before and after pictures.
#top {
top: 0;
position: fixed;
z-index: 1;
}
.topbar {
height: 90px;
background-color: #24414e;
border-left: 2px solid #24414e;
border-right: 2px solid #24414e;
border-top: 2px solid #24414e;
border-bottom: 2px solid #24414e;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
animation-name: greeting;
animation-duration: 8s;
animation-delay: 1s;
}
#keyframes greeting {
0% {
background: url('https://cdn.dribbble.com/users/751466/screenshots/3360272/hello-3.gif');
background-size: 100% 100%;
}
60% {
opacity: 1;
}
}
/*
.topbar:hover{
background:url('https://cdn.dribbble.com/users/751466/screenshots/3360272/hello-3.gif');
background-size: 100% 100%;
}
*/
.logo {
transform: translateY(50%);
font-family: "Dancing Script";
color: #ffffff;
}
.holder {
width: 5%;
height: 80%;
margin-right: 30px;
margin-top: 10px;
}
.out {
margin-top: 46px;
color: #ffffff;
margin-right: 0;
}
.out:hover {
text-decoration: underline;
}
.menu {
height: 15%;
margin-top: 0px;
background-color: #f7ce3e;
}
/*
.iconbar{
margin-top: 20px;
margin-right: 20px;
margin-left:20px;
height =
text-align: center;
border-left: 2px solid #24414e;
border-right: 2px solid #24414e;
border-top: 2px solid #24414e;
border-bottom: 2px solid #24414e;
}
*/
.icon {
margin-top: 10px;
color: #24414e;
animation-name: iconSlide;
animation-duration: 1s;
}
.txt {
font-size: 15px;
visibility: hidden;
margin-top: 0px;
color: #24414e;
}
#keyframes iconSlide {
0% {
transform: translateX(600%);
}
100% {
transform: translateX(0);
}
}
.icon-1:hover~.txt-1 {
visibility: visible;
}
.icon-2:hover~.txt-2 {
visibility: visible;
}
.icon-3:hover~.txt-3 {
visibility: visible;
}
.icon-4:hover~.txt-4 {
visibility: visible;
}
.icon-5:hover~.txt-5 {
visibility: visible;
}
.icon-6:hover~.txt-6 {
visibility: visible;
}
.icon:hover {
color: #ffffff;
}
.rest {
height: 100%;
}
.contacts {
position: relative;
z-index: -1;
}
<!DOCTYPE html>
<html lang="en">
<!---This is for importing bootstrap and the CSS File--->
<head>
<title>Dashboard</title>
<link rel="stylesheet" href="templatestyle.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Dancing Script' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!---Nav Bar and Header--->
<section id="top">
<!---Header--->
<div class="container-fluid topbar">
<h1 class="float-left logo">Example</h1>
<h5 class="float-right out">log out</h5>
<img src="blank-person-male.png" alt="profilepic" class="rounded-circle float-right holder"></img>
</div>
<!---Nav Bar--->
<div class="container-fluid menu" id="openMenu">
<div class="row">
<div class="col-2 text-center">
<i class="fa fa-tachometer fa-2x icon icon-1" aria-hidden="true"></i>
<h5 class="txt txt-1">Dashboard</h5>
</div>
<div class="col-2 text-center">
<i class="fa fa-user fa-2x icon icon-2" aria-hidden="true"></i>
<h5 class="txt txt-2">Profile</h5>
</div>
<div class="col-2 text-center">
<i class="fa fa-certificate fa-2x icon icon-3" aria-hidden="true"></i>
<h5 class="txt txt-3">Certificates</h5>
</div>
<div class="col-2 text-center">
<i class="fa fa-paper-plane fa-2x icon icon-4" aria-hidden="true"></i>
<h5 class="txt txt-4">Send/Apply</h5>
</div>
<div class="col-2 text-center">
<i class="fa fa-cog fa-2x icon icon-5" aria-hidden="true"></i>
<h5 class="txt txt-5">Settings</h5>
</div>
<div class="col-2 text-center">
<i class="fa fa-envelope fa-2x icon icon-6" aria-hidden="true"></i>
<h5 class="txt txt-6">Messages</h5>
</div>
</div>
</div>
</section>
<section class="rest container-fluid">
<h2 class="text-center"><u>Dashboard</u></h2>
<!---Contacts--->
<h4>Online contacts:</h4>
<div class="row contacts">
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 1</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 2</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 3</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 4</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 5</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 6</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="card border-success">
<div class="card-header">Person 7</div>
<div class="card-body">
<img src="blank-person-male.png" alt="profilepic" class="card-img-top rounded"></img>
</div>
<div class="card-footer">
<button type="Button" class="bg-primary rounded mx-auto .text-light">Send Chat</button>
</div>
</div>
</div>
</div>
</section>
</body>
</html>
This is a simple fix, just set your Header z-index: 2; and your cards z-index: 1;.
I didn't really go over your code but setting the header an higher z-index as the content for sure will fix it.
The answer is you have given position:fixed to the header(.top) to fix it at the top with top:0, so you must need to give margin-top to the section next to it containing classes class="rest container-fluid" otherwise it will overlap as it seems with absolute positioned element.
Setting margin:top:159px fix the issue.
Please note that 159px is top header's height here. Happy coding :)
Use the fixed-top class instead of the top CSS code. And add 160px padding-top for the body.
/*
The headers height is 159.5px
*/
body {
padding-top: 160px;
}
fixed-top removes the element that you use it for, from the normal flow of the content, and, hence, the element will overlay the other content
To fix the issue, you need to push down the main content equal or larger than the height of the fixed-top element. You can do so by setting the padding-top of the body equal or larger than the fixed-top element's height. For example, if the fixed-top element's height is 72px, padding-top of body should be, at least, 72px. If you wish, you can use relative units: padding-top: 4.5rem; instead of padding-top: 72px;.
body {
padding-top: 72px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet" />
<div class="fixed-top bg-light">
<div>
<noscript>
<h1 style="color:#FF0000;">
This reportFile will not be navigable without Javascript, please enabled Javascript
</h1>
</noscript>
<img srcset="style/songkongheader.png 400w,style/songkongheader-medium.png 200w,style/songkongheader-small.png 100w," sizes="(max-width:800px) 200px,(max-width:600px) 100px,400px" class="mb-2">
</div>
<header>
<h2 class="subheading" title="Start Fixing Songs">
<a class="mx-2">
Fix Songs
</a>
</h2>
</header>
</div>
<main class="container-fluid bg-primary bd-">
<div class="row">
<div class="col py-5">Hello</div>
</div>
</main>
This is what both bootstrap-3 and bootstrap-4 has done. I recommend you to inspect it yourself.
You may find these two link useful.
w3schools - How to - fixed menu
teamtreehouse - div hiddne below fixed position navbar
A codepen of your work
Hi guys so i have a background image with 5 small divs in it. I was wondering what is the best way to center the 5 divs in the middle of the image. I for some reason cant find a way to put it in the middle without using margin-left: 300px or something like this. I tried to use div align in the row but that doesn't work is well
HTML:
<div class="parallax2">
<div class="info1">
<span class="border"></span>
<div class="row">
<div class="col-xs-6 col-sm-4 col-md-2" >
<!-- work_process -->
<div class="work_process">
<div class="work_process-box">
<i class="fa fa-lightbulb-o"></i>
<h4>IDEA</h4>
</div>
</div>
<!-- work_process -->
</div>
<div class="col-xs-6 col-sm-4 col-md-2">
<!-- work_process -->
<div class="work_process">
<div class="work_process-box">
<i class="fa fa-bank"></i>
<h4>DESIGN</h4>
</div>
</div>
<!-- work_process -->
</div>
<div class="col-xs-6 col-sm-4 col-md-2">
<!-- work_process -->
<div class="work_process">
<div class="work_process-box">
<i class="fa fa-comments-o"></i>
<h4>DEVELOP</h4>
</div>
</div>
<!-- work_process -->
</div>
<div class="col-xs-6 col-sm-4 col-md-2">
<!-- work_process -->
<div class="work_process">
<div class="work_process-box">
<i class="fa fa-desktop"></i>
<h4>TEST</h4>
</div>
</div>
<!-- work_process -->
</div>
<div class="col-xs-6 col-sm-4 col-md-2">
<!-- work_process -->
<div class="work_process">
<div class="work_process-box">
<i class="fa fa-rocket"></i>
<h4 id="three" >LAUNCH</h4>
</div>
</div>
<!-- work_process -->
</div>
</div>
</div>
</div>
CSS:
.parallax2 {
background-image: url(https://wallpapercave.com/wp/e7KiEL3.jpg);
min-height: 400px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
padding: 10px 20px;
}
.work_process {
position: relative;
text-align: center;
margin: 0 auto;
}
.work_process .work_process-box {
outline: 4px solid #FFFFFF;
border-radius: 50%;
height: 120px;
margin: 2em auto 3em;
padding: 16px 10px;
width: 120px;
}
.work_process-box i {
font-size: 32px;
line-height: 52px;
width: 52px;
color: #FFFFFF;
}
.work_process-box h4 {
font-weight: 400;
margin: 0;
color: black;
}
I tried to add Margin-left: 200px in the work process class but i wasent sure if this is the correct way to do it.
Any help would be great
Link
#RonTheOld, you can turn your row into a flexbox by giving it the diplay:flex; property and 'justify-content: center' property to center the items in the flexbox.
I've done this as an inline style attribute on the row element for your code.
Here's a codeply project with the code in action.
I try to reach one point using div's and bootstrap. It should be in one line number of points and smaller information about points and in second area should be bootstrap icon and again information about icon.
My code:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row center-block">
<div class="col-md-5" style="padding: 0px; padding-left: 10px; ">
<i class="pull-left h2"><h2>72</h2></i> TWOJE PUNKTY
</div>
<div class="col-md-7" style="padding: 0px">
<i class="fa fa-trophy fa-2x pull-left"></i> WYRÓZNIENIE SZYBKI BILL
</div>
<br>
<table class="table">
<tr>
<th><h2>72</h2></th>
<th>you points</th>
<th><i class="fa fa-trophy fa-2x pull-left"></i></th>
<th>fastL</th>
</tr>
</table>
</div>
</div>
Try below code and you can adjust col- class according to you
.flex-div {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
align-items: center;
}
.icon-text {
float: left;
margin-right: 10px;
font-size: 34px;
}
.icon-text h2 {
margin: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row center-block row-eq-height">
<div class="col-xs-6 flex-div">
<div class="icon-text">
<h2>72</h2>
</div>
<div class="info-text">
TWOJE PUNKTY<br/>
WYRÓZNIENIE SZYBKI BILL
</div>
</div>
<div class="col-xs-6 flex-div ">
<div class="icon-text">
<i class="glyphicon glyphicon-certificate"></i>
</div>
<div class="info-text">
Your Achivement Reached
</div>
</div>
</div>
</div>
You can achieve that effect using something like this.
HTML:
<div class="points"> 72 </div>
<div class="points-details">
Your
points
</div>
<div class="icon">+</div>
<div class="icon-details">
Your
Achievment
Reached
</div>
CSS:
.points{
display: inline-block;
}
.points-details{
display: inline-block;
}
.icon{
margin-left: 20px;
display: inline-block;
}
.icon-details{
display: inline-block;
}