Position of elements in Bootstrap - html

I have 7 images. I need to see 5 images in one row, and 2 more images in another row below in the center. I made 5 images in a row, but I can not position the other 2 images in the center below. Also, in responsive version I need 2 images under each other and 1 image in the center and they need to have border-radius:100%, but it does not work. What`s wrong with my code?
This is html:
#media all and (max-width: 1024px) {
.ring {
border-radius: 100%;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-sm col-6">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="0.1s" style="border-radius: 0;">
<img src="img/1.jpg" style="border-radius: 100%;">
</div>
</div>
<div class="col-sm col-6">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="0.3s" style="border-radius: 0;">
<img src="img/2.jpg" style="border-radius: 100%;">
</div>
</div>
<div class="col-sm col-6 hightechxl">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="0.5s" style="border-radius: 0;">
<img src="img/1.jpg" style="border-radius: 100%;">
</div>
</div>
<div class="col-sm col-6">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="0.7s" style="border-radius: 0;">
<img src="img/2.png" style="border-radius: 100%;">
</div>
</div>
<div class="col-sm col-6">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="0.9s" style="border-radius: 0;">
<img src="img/1.png" style="border-radius: 100%;">
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="1.1s" style="border-radius: 0;">
<img src="img/2.png" style="border-radius: 100%; width: 150px; height: 150px;">
</div>
</div>
<div class="col-sm">
<div class="single-specials text-center wow fadeInUp" data-wow-delay="1.3s" style="border-radius: 0;">
<img src="img/1.png" style="border-radius: 100%;">
</div>
</div>
</div>
</div>
I am using bootstrap4, if there is another decision without bootstrap, please, show me how.

I just make to demonstrate code for you at: https://codepen.io/tien-bui/pen/mamemO
So the basic ideas of Bootstrap is every row have 12 col, so if you want to display 5 item in 1 row you need to set the col prefix at 2. For example: target small screen col-sm-2, target large screen col-lg-2. And you need to target all the device to achieve the responsive, it will look like this:
<div class="col-lg-2 col-md-2 col-sm-6 col-6"></div>

You can use flex, set width to 18% for example - that little less than 20% , which can take 5 items and it will give you some space for margin.
Use media query for the second version and set flex-basis to 48%.
.cont{
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.item{
flex-basis: 18%;
flex-shrink: 0;
flex-grow: 0;
border: 1px solid black;
height: 50px;
margin: 5px;
}
#media all and (max-width: 1024px) {
.item {
flex-basis: 48%;
}
}
<div class="cont">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
</div>

Related

How can I create a Bootstrap grid layout with a responsive but minimum width left column and scrollable right column?

I am close to achieving this look and behavior but I am having issues with the scrolling of the right column. The scroll bar appears but does not scroll the content on the right column. Should look like this:
.
Currently looks like this:
There are probably multiple approaches or changes I can take or make but any suggestions are welcome! Code is provided below.
.scroller {
overflow-x: scroll;
white-space: nowrap;
}
.row {
display: flex;
flex-wrap: nowrap;
}
.col-md-4 {
min-width: 240px;
}
.col-md-8 {
flex-grow: 1;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<div class="row">
<div class="col-4" style="min-width: 240px;">
<div class="row pb-1">
<div class="col-3 offset-3">
<b>NAME</b>
</div>
</div>
<div class="row row-striped align-items-center pb-1 pt-1">
<div class="col-3">
<img src="https://media.api-sports.io/football/players/730.png" alt="player photo" width="40px" height="40px">
</div>
<div class="col-9 player-table-text">
<div>
Thibaut Courtois
<span class="ps-1 player-number-text">1</span>
</div>
</div>
</div>
</div>
<div class="col scroller" style="min-width: 500px;">
<div class="row pb-1">
<div class="col-2 offset-1">
<b>POS</b>
</div>
<div class="col-2">
<b>AGE</b>
</div>
<div class="col-2">
<b>HT</b>
</div>
<div class="col-2">
<b>WT</b>
</div>
<div class="col-2">
<b>NAT</b>
</div>
</div>
<div class="row row-striped align-items-center pb-1 pt-1 player-table-text" style="height:48px;">
<div class="col-2 offset-1">
GK
</div>
<div class="col-2">
30
</div>
<div class="col-2">
6' 7"
</div>
<div class="col-2">
212 lbs
</div>
<div class="col-2">Belgium</div>
</div>
</div>
</div>

How to get desired html layout in small screens which is differ in large screens

I implemented markup code and got desired layout in large screens, but on reducing size of screen to the phone level I need layout like image-3 and in big screen like laptops it should be like image-1. Image-1,Image-3 refer to single image that i have linked.
I am using Bootstrap-4, html-5
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<h6>Image-1 in large screens like laptop</h6>
<div class="row">
<div class="col-sm-8 ">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-sm-4">
<div class="card"><button class="bg-danger" style="padding: 10%; font-size: 15px">oneSmall</button></div>
<div class="card"><button class="bg-danger" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
<!-- In order to fulfil desired layoutin small screens, i implemented this-->
<div class="container-fluid">
<h6>Image-2 after i made changes to get layout like Image-3,but in large screen it looks</h6>
<div class="row">
<div class="col-sm-8 col-12 ">
<div class=" card">
<button class="bg-dark" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="card col-6"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
<div class="card col-6"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<h6>Image-3, like this i need to get in phone's screen, or smaller devices</h6>
<div class="row">
<div class="col-12">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="card col-6"><button class="bg-danger" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button></div>
<div class="card col-6"><button class="bg-danger" style="padding-left: 50%; padding-bottom: 10%;font-size: 15px; width: 100%">oneSmall</button></div>
</div>
</div>
Image that describes layout
Use the responsive grid classes to change the layout at the desired breakpoints.
For example, col-12 col-md-8 means 8 columns wide on md and larger, and 12 columns wide on md and smaller:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-8">
<div class=" card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-12 col-md-4">
<div class="row h-100">
<div class="col-6 col-md-12">
<div class="card h-100">
<button class="bg-danger h-100" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button>
</div>
</div>
<div class="col-6 col-md-12">
<div class="card h-100">
<button class="bg-danger h-100" style="padding-right: 50%; padding-bottom: 10%; font-size: 15px; width: 100%">oneSmall</button>
</div>
</div>
</div>
</div>
</div>
</div>
https://www.codeply.com/go/eTGcVjgAWH
Try with this code. Hope can help you.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 col-sm-12">
<div class="card">
<button class="bg-danger" style="padding: 15%; font-size: 15px">bigone</button>
</div>
</div>
<div class="col-lg-4 col-sm-12">
<div class="row">
<div class="col-md-12 col-sm-6">
<div class="card"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
<div class="col-md-12 col-sm-6">
<div class="card"><button class="bg-dark" style="padding: 10%; font-size: 15px">oneSmall</button></div>
</div>
</div>
</div>
</div>
</div>

Card Positioning in IE 11 is different then Firefox

I'am trying to build responsive website using Materialized framework. I am having issue where my card positioning is not correct in IE. However, It is working fine in Firefox. I am not sure where the problem is occuring. My assumption is something related to the margin I've set to Auto.
I've tried to correct it in Style.CSS and Materialized.CSS in main {} and body {}. But still having issue.
Container:
.container {
margin: 0 auto;
max-width: 1280px;
width: 90%;
min-height: 100%;
}
Structure:
<main>
<div class="container main-content">
<!-- Test Automation Cards -->
<div class="col s12" style="padding-top: 40px;padding-bottom: 50px;text-align: center">
<p class="flow-text center">Design Tools</p>
</div>
<div class="row" style="display: flex;flex-wrap: wrap;justify-content: center;">
<div class="col s12 m6 l4" style="flex: 20%; max-width: 30%;box-sizing: border-box;padding: 15px;">
<a href="http://agilehq/" target="_blank">
<div class="card waves-effect">
<div class="card-image">
<img src="img/agile.png">
<span class="card-title"></span>
</div>
<div class="card-content" style="text-align: center">
<p>Search Design Documents</p>
</div>
</div>
</a>
</div>
<div class="col s12 m6 l4" style="flex: 20%; max-width: 30%;box-sizing: border-box;padding: 15px;">
<a href="http://sharepoint/sites/wip/WorkInProgress/Forms/Project.aspx" target="_blank">
<div class="card waves-effect">
<div class="card-image">
<img src="img/folder.png">
<span class="card-title"></span>
</div>
<div class="card-content" style="text-align: center">
<p>WIP ShareDrive</p>
</div>
</div>
</a>
</div>
<div class="col s12 m6 l4" style="flex: 20%; max-width: 30%;box-sizing: border-box;padding: 15px;">
<a href="http://crdr/" target="_blank">
<div class="card waves-effect">
<div class="card-image">
<img src="img/tfs.jpg">
<span class="card-title"></span>
</div>
<div class="card-content" style="text-align: center">
<p>CRDR</p>
</div>
</div>
</a>
</div>
</div>
</div>
</main>
Main:
main {
flex: 1 0 auto;
}
Output is different in Firefox then IE.
Check Both Screenshot Here.

How to center a jumbotron?

How can i center a jumbotron in the center of my page?
I already tried col-lg-6 with float-lg-center.
.jumbotron {
min-width: 585px;
margin: 10px auto;
display: flex;
justify-content: center;
margin: 10px 10px 10px 10px;
border: 0.08em solid black;
}
h1 {
font-size: 6em;
color: #484949;
}
#socDesc {
color: black;
}
body {
min-width: 520px;
}
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.css" rel="stylesheet" />
<div class="col-lg-8 col-md-10 col-sm-12 col-xs-12 offset-lg-2 offset-md-1 float-md-center">
<div class="jumbotron">
<div class="container">
<div class="container-fluid">
<div class="column">
<h1 class="text-center">Society</h1>
<hr />
<h4 class="text-center">"That's one small step for a man, one giant leap for mankind" - Neil Armstrong</h4>
<hr />
<div class="figure">
<div class="row">
<div class="col-lg-6 col-md-5 col-sm-4 col-xs-3">
<img id="" class="figure-img img-fluid rounded" src='http://4.bp.blogspot.com/-1tvR6wEiwiI/VYJSH4pfrsI/AAAAAAAABa8/RoQtTAtnD6Q/s1600/PBS.jpg' />
</div>
<div class="col-lg-6 col-md-5 col-sm-4 col-xs-3">
<img id="" class="figure-img img-fluid rounded" src='http://www.extremetech.com/wp-content/uploads/2013/04/lhc17.jpg' />
</div>
</div>
<!-- row-->
<figcaption class="figure-caption">This is the Large Ha</figcaption>
<hr />
</div>
<!-- figure -->
</div>
<!-- column -->
</div>
</div>
</div>
</div>
View on Codepen
Add text-center in the class
<div class="jumbotron text-center">
Try <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 offset-3 float-md-center"> That worked for me, but offset-xs-3 may be more proper due to the following:
It wasn't working in codepen for some reason but if you want the same amount of columns on all screen sizes you can use only col-xs-6 and it will apply that to all larger screen sizes.

I want the logo and heading in center for all screen size

HTML CODE:
<div class="container-fluid">
<header class="header-area row">
<div class="container-fluid">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
CSS CODE:
.header-area .logo-area img {
width: 90px;
height: auto;
margin: 52px 0 120px;
}
.img-responsive {
margin: 0 auto;
}
I tried in many ways but i failed.The solution should be done using bootstrap.Please help me.
here is a solution, just add css display:inline-block and put all your tag between this html thg <center > </center>
here is modified code
.inline{
display: inline-block;
margin-right: auto;
margin-left: auto;
}
.header-area .logo-area img {
width: 90px;
height: auto;
margin: 52px 0 120px;
}
.img-responsive {
margin: 0 auto;
}
<center>
<div class="container-fluid">
<header class="header-area row">
<div class="container-fluid inline">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid inline">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
</center>`
good luck..
try adding 1 more class text-center to conrainer-fluid and remove any margins you applied in your css
<div class="container-fluid text-center">
<header class="header-area row">
<div class="container-fluid">
<div class="logo-area row">
<div class="col-xs-7 col-xs-offset-5 col-sm-7 col-sm-offset-5">
<img class="img-responsive" src="images/logo.png" alt="V" />
</div>
</div>
</div>
<div class="container-fluid text-center">
<div class="heading row">
<div class="col-xs-10 col-xs-offset-2 col-sm-9 col-sm-offset-3 col-md-7 col-md-offset-5">
<h1>I love design </h1>
</div>
</div>
</div>
</header>
</div>
Add this style in you CSS file:
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
And also add apply this class on your image:
<img class="img-responsive" src="images/logo.png" class=".center-block" alt="V" />
Demo