Horizontal Centre Alignment Of Divs (Grid Layout) - html

I have designed a grid layout using divs. As you can see below. However I need to center these horizontally in the middle of the web browser. Could somebody please show me how? Everything I have tried seems to align all of the divs centrally as if they are in one column over the top of each other.
Thanks in advance.
HTML
<div class="row">
<div class="col">
<div class="trigger vertical img1">
<div tabindex="0" class="maincontent static"><div class="slider">
<img src="slide1.png" width="200" />
<img src="slide2.png" width="200" />
<img src="slide3.png" width="200" />
<img src="slide4.png" height="200"/>
</div></div>
</div>
</div>
<div class="col">
<div class="trigger img1">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div></div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
</div>
<!-- </div>
<div class="row">-->
<div class="col">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img4"><img src="STEP1.jpg" width="200"/><p>Text Here 4<p></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img5"><img src="STEP3.jpg" width="200"/><p>Text Here 5<p></div>
</div>
</div>
<div class="col">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img6"><img src="STEP2.jpg" width="200"/><p>Text Here 6<p></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img7"><img src="STEP4.jpg" width="200"/><p>Text Here 7<p></div>
</div>
</div>
</div>
<div class="row">
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger large">
<div tabindex="0" class="maincontent staticlarge"><div class="slider">
<img src="slide1.png" height="200" width="400" />
<img src="slide2.png" height="200" width="400" />
<img src="slide3.png" height="200" width="400" />
<img src="slide4.png" height="200" width="400" />
</div></div>
</div>
</div>
<div class="row">
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent staticlarge">
<iframe align="center" src="clock2.php" width="300px" height="200px" scrolling="no" frameBorder="0" style="margin-left:5px;"></iframe></div></div>
CSS
<style type="text/css">
.trigger {
width:200px;
height:200px;
}
.trigger.large {
width: 400px;
}
.trigger.vertical {
height: 400px;
}
.trigger.vertical * {
height: 400px;
}
.hover-img, .hover-img.hover_effect {
position: relative;
width: 200px;
height: 200px;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;
-webkit-transform-style: preserve-3d;
text-align: center;
font-size: 0;
-webkit-user-select: none;
-webkit-touch-callout: none;
border-style: solid;
border-width: 1px;
border-color: #CCCCB2;
border-radius: 5px;
}
.static {
position: relative;
width: 200px;
height: 200px;
text-align: center;
font-size: 0;
border-style: solid;
border-width: 1px;
border-color: #CCCCB2;
border-radius: 5px;
}
.staticlarge {
position: relative;
width: 400px;
height: 200px;
text-align: center;
font-size: 0;
border-style: solid;
border-width: 1px;
border-color: #CCCCB2;
border-radius: 5px;
}
.trigger.large .hover-img, .trigger.large .hover-img.hover_effect {
width: 400px;
}
.trigger:hover > .hover-img {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
font-size: 14px;
color: #FFF;
}
.trigger:hover > .hover-img.img4 {
background-color: #f47878;
}
.trigger:hover > .hover-img.img5 {
background-color: #f6c447;
}
.trigger:hover > .hover-img.img6 {
background-color: #92cf96;
}
.trigger:hover > .hover-img.img7 {
background-color: #f47878;
}
.trigger:hover > .hover-img.img12 {
background-color: #92cf96;
}
.trigger:hover .hover-img img {
display: none;
}
#container {
width:960px;
margin: 0 auto;
}
.row {
display: flex;
}
.col {
display:inline-block;
}
.trigger.large .hover-img, .trigger.large .hover-img.hover_effect {
width: 400px;
}
#apDiv1 {
position: absolute;
width: 100px;
height: 200px;
z-index: 1;
background-color: #999999;
}
.trigger:hover p {
display:block;
transform:scaleX(-1)
}

Use a div to wrap your HTML like below <div class="bodyCont">
<div class="bodyCont">
<div class="row">
<div class="col">
<div class="trigger vertical img1">
<div tabindex="0" class="maincontent static"><div class="slider">
<img src="slide1.png" width="200" />
<img src="slide2.png" width="200" />
<img src="slide3.png" width="200" />
<img src="slide4.png" height="200"/>
</div></div>
</div>
</div>
<div class="col">
<div class="trigger img1">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div></div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
</div>
<!-- </div>
<div class="row">-->
<div class="col">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img4"><img src="STEP1.jpg" width="200"/><p>Text Here 4<p></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img5"><img src="STEP3.jpg" width="200"/><p>Text Here 5<p></div>
</div>
</div>
<div class="col">
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img6"><img src="STEP2.jpg" width="200"/><p>Text Here 6<p></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent hover-img img7"><img src="STEP4.jpg" width="200"/><p>Text Here 7<p></div>
</div>
</div>
</div>
<div class="row">
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger large">
<div tabindex="0" class="maincontent staticlarge"><div class="slider">
<img src="slide1.png" height="200" width="400" />
<img src="slide2.png" height="200" width="400" />
<img src="slide3.png" height="200" width="400" />
<img src="slide4.png" height="200" width="400" />
</div></div>
</div>
</div>
<div class="row">
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent static"><div class="slider2">
<img src="slide1.png" height="200" width="200" />
<img src="slide2.png" height="200" width="200" />
<img src="slide3.png" height="200" width="200" />
<img src="slide4.png" height="200" width="200" />
</div></div>
</div>
<div class="trigger">
<div tabindex="0" class="maincontent staticlarge">
<iframe align="center" src="clock2.php" width="300px" height="200px" scrolling="no" frameBorder="0" style="margin-left:5px;"></iframe></div></div>
</div>
Then since you are having fixed width for all these items it becomes easy calculate the width for all total width=800px.
Apply it to the outercontainer and margin:0 auto; will do the trick
CSS
.bodyCont{
width :800px;
margin:0px auto;
}
DEMO

simply give the first div (the one before class="row") a class (i.e. wrapper) and insert following css to center the complete wrapper content into the middle of the screen:
.wrapper {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
}

Related

Fadeout with jquery.slidertron-1.1.js

Currently i'm using this script and i kinda like it
And here's how the HTML and CSS looks like.
<div id="slider">
<div class="viewer">
<div class="reel">
<div class="slide"> <img src="images/IMG9.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG8.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG7.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG6.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG5.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG4.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG3.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG2.jpg" width="900" height="500" alt="" /> </div>
<div class="slide"> <img src="images/IMG1.jpg" width="900" height="500" alt="" /> </div>
</div>
</div>
#slider
{
position: relative;
width: 900px;
margin: 0 auto;
}
#slider .viewer
{
width: 900px;
height: 500px;
overflow: hidden;
margin: 0 auto;
}
#slider .viewer .reel
{
isplay: none;
height: 500px;
}
#slider .viewer .reel .slide
{
position: relative;
width: 900px;
height: 500px;
}
Only problem is that i like the faded version better. So is there any easy way to change that or do i have to switch js script completely?

Fitting Flex Items inside certain height Div

I'm trying to fit dynamically added items into a flex div of a certain height. For example my container div is 100% width and 25vh height and I have 50 images loading inside of it within their child containers. I want these containers to resize accordingly and to fit inside that div, staying inside of it, 6-7 child divs per row. So far when I use flex-grow:15% value and they get moved to a new row, they don't resize at all and overlap outside, moving of the div. Is there any way to make it work?
Here is what I do:
<div class="brand-container">
<div class="tier-top-1">
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
<div class="tier-item">
<img src="cat.jpg" />
</div>
</div>
</div>
And CSS:
.brand-container {
width: 100%;
height: 100vh;
}
.tier-top-1 {
width: 100%;
height: 25vh;
background: white;
display: flex;
justify-content: space-around;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
.tier-item {
margin: 1rem;
justify-self: center;
text-align: center;
flex: 1 1 15%;
}
.tier-top-1 img {
max-height: 20vh;
}
With the amount of margin plus the height of images coming into play, to have only 6 or 7 images per row, you need to be able to run a calculation using JavaScript to set the max-height of each image as 25vh minus the space between rows, that difference divided by the number of rows.
I adjusted the flex value to be 0 0 13vw and adjusted the margin to just be margin-top for the images. You may have to calculate this number for various scenarios as well.
See the snippet below. Click on Full Page to see the solution. Otherwise, the vh units will be calculated from the height of your browser, not the height of the snippet window.
const imgs = document.querySelectorAll(".tier-top-1 img");
const numImgs = imgs.length;
const rows = Math.ceil(numImgs / 7);
const maxHeight = (25 - rows - 1) / rows;
imgs.forEach(img=> img.style.maxHeight = maxHeight + "vh");
.brand-container {
box-sizing: border-box;
width: 100%;
height: 100vh;
}
.tier-top-1 {
box-sizing: border-box;
width: 100%;
height: 25vh;
background: white;
display: flex;
justify-content: space-around;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
border: 1px solid black;
}
.tier-item {
box-sizing: border-box;
margin: 0;
padding: 0;
margin-top: .5vh;
align-self: center;
text-align: center;
flex: 0 0 13vw;
}
.tier-top-1 img {
max-height: 13vw;
}
<div class="brand-container">
<div class="tier-top-1">
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
<div class="tier-item">
<img src="https://via.placeholder.com/400x400/?text=Image" />
</div>
</div>
</div>

How to center a bootstrap row containing 3 images?

I have a container-fluid that contains 3 row
Row 1: 4 images
Row 2: 4 images
Row 3: 3 images
I am trying to center Row 3, I tried adding Row 3 inside another class called "container" and tried the "left, right" in css but did not work, may you please help?
.b3 {
padding-bottom: 20px;
}
.client-section {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.img-responsive {
padding-bottom: 10px;
}
#clients {padding-top:10px;padding-bottom:50px;color: #7e7e7e; background-color:#151515;}
<section class="container-fluid client-section" id="clients">
<div class="row">
<div>
<b class="col-lg-10
col-md-10
col-sm-10
col-xs-10
col-lg-push-1
col-md-push-1
col-sm-push-1
col-xs-push-1 b2 b3">Clients</b>
</div>
</div>
<div class="col-lg-10
col-md-10
col-sm-10
col-xs-10
col-lg-push-1
col-md-push-1
col-sm-push-1
col-xs-push-1">
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row center">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
</div>
</section>
Is this your solution
.b3 {
padding-bottom: 20px;
}
.client-section {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.img-responsive {
padding-bottom: 10px;
}
.center .img-responsive{
margin:0 auto;
display:block;
}
#clients {padding-top:10px;padding-bottom:50px;color: #7e7e7e; background-color:#151515;}
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row center">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
The last row have 9, need to be 12, replace 3 by 4.
<div class="row">
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
And change the css by this:
.img-responsive {
padding-bottom: 10px;
display:block;
margin-left: auto;
margin-right: auto
}
you can use bootstrap class text-center
or you can just add this css
.center{
text-align: center;
}
.b3 {
padding-bottom: 20px;
}
.client-section {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.img-responsive {
padding-bottom: 10px;
}
#clients {padding-top:10px;padding-bottom:50px;color: #7e7e7e; background-color:#151515;}
.center{
text-align: center;
}
<section class="container-fluid client-section" id="clients">
<div class="row">
<div>
<b class="col-lg-10
col-md-10
col-sm-10
col-xs-10
col-lg-push-1
col-md-push-1
col-sm-push-1
col-xs-push-1 b2 b3">Clients</b>
</div>
</div>
<div class="col-lg-10
col-md-10
col-sm-10
col-xs-10
col-lg-push-1
col-md-push-1
col-sm-push-1
col-xs-push-1">
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-4">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-2">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
<div class="row center">
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
<div class="col-lg-3">
<img class="img-responsive" src="imgs/UserImage.png" width="200" height="200" />
</div>
</div>
</div>
</section>

Make row of div horizontal overflow

I have a row of around 6 divs. Currently if the row of divs suppresses the width of the page, it puts the next div under the rest, like this
My question is: **how do I have a row of horizontal divs with a scroll bar like this **
Here's my code:
<div style="overflow:auto;">
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
</div>
<style>
.box {
float: left;
width: 127px;
margin: 9.2px;
border: 5px solid red;
}
</style>
JSFIDDLE: http://jsfiddle.net/ZrpHv/59/
You can wrap all <div class="box"> into one more div and add width in px
.box {
float: left;
width: 127px;
margin: 9.2px;
border: 5px solid red;
}
<div style="overflow:auto;">
<div style="width: 1000px;">
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
<div class="box">
<span>Example</span>
<br>
<img src="http://thumb9.shutterstock.com/photos/display_pic_with_logo/59156/113033326.jpg" width="50" height="80" />
</div>
</div>
</div>
Please try this:
.parentdiv {
overflow-x: scroll;
width: 450px;
white-space: nowrap;
border: 1px solid black;
}
.box{
width: 127px;
margin: 9.2px;
border: 5px solid red;
display: inline-block;
}

How to align div objects in rows

I wanna align my six div objects, which are basicly boxes, into three rows.
(picture i draw to demonstrate >
I'm really clueless how i should align my boxes, so that they come ento these rows.
Right now, it's just one long horizontal line.
I'll post my code here :)
HTML:
<div class="boxbox">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" width="250" height="150" class="topi" />
</div>
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
CSS:
This is basicly just hover over animations, it'll be way to long to post here. Please write if you will need my CSS.
Any help would be greatly appreciated!
According to the picture, here's the code:
Live demo
HTML
<div class="boxbox">
<div class="row">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" width="250" height="150" class="topi" />
</div>
</div>
<div class="row">
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
</div>
CSS
.row{
display:block;
}
.row div{
display:inline;
}
You can see this here:
HTML:
<div class="boxbox">
<div id="newsb">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="billetb">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="infob">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="kontak">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="log">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="cf4a">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
CSS:
.boxbox {
height:200px;
margin:10px;
}
.boxbox > div {
width:32%;
height:100px;
background-color:Black;
display:inline-block;
margin:1px;
}
* {
margin:0;
padding:0;
}
.left {
float:left;
}
.right {
float:right;
}
img {
margin-top: 12px;
}
You cansee this here: http://jsfiddle.net/78UEX/1/
Hope this helps!!!
Try this demo ..
You can let each div take its place by it-self, and if the horizontal row has no place for another div, it will go to another row under the first row ..
<style>
.boxbox{
position: relative;
}
.box{
float: left;
width: 33.3%;
}
</style>
<div class="boxbox">
<div id="newsb" class="box">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb" class="box">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob" class="box">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" />
</div>
<div id="kontak" class="box">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log" class="box">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a" class="box">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
Another way
demo
or you can set three vertical rows and put two divs in each row ..
<style>
.boxbox{
position: relative;
overflow: hidden;
}
.row{
float: left;
width: 33.3%;
}
</style>
<div class="boxbox">
<div class="row">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
</div>
<div class="row">
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" />
</div>
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
</div>
<div class="row">
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
</div>
According to your picture, you want 2 Rows of 3 Columns. Rows go left/right and Columns go up/down.
There are many different ways to do this.
Here's an example: http://jsfiddle.net/qB55N/
<div class='row'>
<div class='col'>1</div>
<div class='col'>2</div>
<div class='col'>3</div>
</div>
<div class='row'>
<div class='col'>4</div>
<div class='col'>5</div>
<div class='col'>6</div>
</div>
Is this what you are talking about? Example: http://jsfiddle.net/xsZ54/
HTML
<div class="row">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
</div>
<div class="row">
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
</div>
CSS:
.row{
display: table;
width: 100%;
}
.box{
display: table-cell;
}