Display 3 columns each row without using bootstrap - html

This is a wordpress site http://www.jokerleb.com
Each cell has the following code
.post-block-out {
margin: 0 0 8px 0;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.post-block-out {
background: #fff;
-webkit-border-radius: 6px;
border-radius: 6px;
box-shadow: 0 2px 0 0 #E3E4E7;
}
div{
display: block;
}
post-block {
background-color: #fff;
margin: 0;
padding: 20px 15px 15px;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.post-block-out, .searchblock, .paging, .sidebar-block {
background: #fff;
-webkit-border-radius: 6px;
border-radius: 6px;
box-shadow: 0 2px 0 0 #E3E4E7;
}
.content_res {
width: auto;
}
.content_left{
width:30%;
float: none;
margin: auto;
padding: auto;
}
<div class="content_res">
<div class="content_left">
<div class="post-block-out ">
<div class="post-block">
<div class="post-left">
<img class="attachment-ad-medium" alt="" title="" src="http://www.jokerleb.com/wp-content/themes/classipress/images/no-thumb-150x150.png">
</div>
<div class="post-right full">
<div class="tags price-wrap">
<span class="tag-head"><p class="post-price">$1600$</p></span>
</div>
<h3>Kyosk 2m×2m</h3>
<div class="clr"></div>
<p class="post-meta">
<span class="dashicons-before folder">Other Home & Garden</span> <span class="dashicons-before owner">Charbel</span> <span class="dashicons-before clock"><span>August 25, 2017</span></span>
</p>
<div class="clr"></div>
<p class="post-desc">Kyosk ma3moul la snack fi haute rekeb fi madfouf PVC ma3 inaraaa</p>
<p class="stats">23 total views, 0 today</p>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div><!-- /post-block -->
</div>
</div>
</div>
that snippet is affecting every box on the page, they are now aligned in the middle. I want them to be 3 columns per row.
No bootstrap or any grid library because it's affecting the theme, i guess maybe because it has a class called container, so when using bootsrap, the container centers everything. If you know a library that doesn't conflict with the existing code I'd use it.
It's a very old wordpress theme, many of the styles are stored in the database so if I need to add class I might have to do it in jquery
http://jsfiddle.net/tusharj/ucb0bdmj/
Don't worry about it. And you'll see on the website duplicate css code, don't worry about it, I use a plugin to manage css in the development phase, the code I don't want is display:none
All I want is 3 columns on each row. I tried to add float the first left and the third right but the problem is that they move only within their container.
Plus I don't know where to place <div class='row'>, I was trying to do it with bootstrap just to see if it would work, I didn't spot the correct place to create new row

If this is what you expect
Follow this to make it work:
Remove width: 30% of class .content_left
Add display: flex; flex-wrap: wrap; to block you want to show. (In this case was the div with id="block1"
Add width of 33% for each div with class post-block-out
You can try to add some margin or padding to make the gap between divs.
important: I guess this is better than use floats if you want to avoid conflicts. And, if you want to make it responsive, just use media queries and add width: 100%; to each div with class post-block-out

You can try this responsive solution:
* {margin: 0; padding: 0; box-sizing: border-box}
.content-left {
position: relative;
width: 1200px;
max-width: 100%;
margin: 0 auto;
column-count: 3;
column-gap: 10px;
}
.content-left > .post-block-out {
position: relative;
margin-bottom: 10px;
page-break-inside: avoid;
break-inside: avoid-column;
box-shadow: 0 0 1px #000;
}
.content-left > .post-block-out > img {
display: block;
width: 460px;
max-width: 100%;
}
.content-left > .post-block-out > .info {
display: flex;
justify-content: space-between;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
padding: 10px;
color: #fff;
background: #000;
opacity: .75;
}
.content-left > .post-block-out > .info > span {
margin: 0 5px;
}
.content-left > .post-block-out > .info > .title {
text-transform: uppercase;
}
#media (max-width: 1200px) {
.content-left {padding: 0 10px}
}
#media (max-width: 768px) {
.content-left {column-count: 2}
}
#media (max-width: 480px) {
.content-left {column-count: 1}
}
<div class="content-left">
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/themes/classipress/images/no-thumb-150x150.png" alt="">
<div class="info">
<span class="title">Kyosk 2m x 2m</span><span class="price-tag">$1,600.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/809926-250x250.jpeg" alt="">
<div class="info">
<span class="title">Apartment For Sale in JBEIL</span><span class="price-tag">$180,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/118310-250x250.jpg" alt="">
<div class="info">
<span class="title">Apartment for sale in Adonis</span><span class="price-tag">$230,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/655212-250x250.jpg" alt="">
<div class="info">
<span class="title">Duplex for sale in Al Ghiye</span><span class="price-tag">$125,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/584970-250x250.jpg" alt="">
<div class="info">
<span class="title">Honda CRV 2012</span><span class="price-tag">$19,999.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/628582-250x250.jpg" alt="">
<div class="info">
<span class="title">Malinois puppies For Sale</span><span class="price-tag">$900.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/565460-250x250.jpg" alt="">
<div class="info">
<span class="title">Villa for Sale in Chabtin</span><span class="price-tag">$225,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/53048-250x250.jpg" alt="">
<div class="info">
<span class="title">Shop for Sale in Ain el Roumani</span><span class="price-tag">$140,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/601563-250x250.jpg" alt="">
<div class="info">
<span class="title">Honda CRV</span><span class="price-tag">$ ???</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/484415-250x250.jpg" alt="">
<div class="info">
<span class="title">Apartment in dekwaneh For Rent</span><span class="price-tag">$700.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/4610-250x250.jpg" alt="">
<div class="info">
<span class="title">Nissan Pathfinder</span><span class="price-tag">$5,000.00</span>
</div>
</div>
<div class="post-block-out">
<img src="http://www.jokerleb.com/wp-content/uploads/2017/05/667783-250x250.jpg" alt="">
<div class="info">
<span class="title">Land for sale at Ain Kfaa<br>(عين كفاع)</span><span class="price-tag">$100,000.00</span>
</div>
</div>
</div>

.content-left {width:100%; }
.post-block-out { float:left; width:33% }

Related

How do I align images in a row with equal height?

It seems no matter what I do, I cannot get my images to line up in height. Am I missing something? Originally all images were varying sizes, but I adjusted the resolution in a photo editing software so they are all the same height (1500px) and, for added reinforcement, I have put the height in the image tag as well, yet they are still not lining up and seem to retain their original height/size. It is not a file naming issue as I have checked and double checked these are correct.
Is it a max-width vs max-height issue? They either need to line up uniformly in width or in height, and can't be both unless the images are the exact same sizes? This is my HTML and CSS. I am using a framework called "uiKit" (https://getuikit.com/) and have included its applicable CSS in the code below.
html,
body {
margin: 0;
background-size: cover;
}
.wrapper {
margin-top: 75px;
}
nav {
padding: 25px 25px 75px 175px;
}
address,
dl,
fieldset,
figure,
ol,
p,
pre,
ul {
margin: 0 0 0 0!important;
}
li {
list-style-type: none;
}
.nav-wrapper {
display: flex;
justify-content: space-between;
}
.nav-right {
display: flex;
font-size: 0.875rem;
color: #999;
}
.leftnavpadding {
padding: 0px 0px 0px 20px;
}
footer a {
color: purple;
}
/*Photos page*/
.photoswrapper {
margin: 75px;
}
.photo-grid-padding>* {
padding: 0!important
}
.uk-lightbox-toolbar {
padding: 10px 10px;
background: rgba(0, 0, 0, 0.0);
color: rgba(255, 255, 255, 0.7);
}
.uk-lightbox {
background-color: white;
}
#photomenuwrapper {
padding: 10px;
}
h3.photolink:hover,
.photolink:active {
color: white;
}
/*footer*/
footer {
padding: 150px 100px 100px 100px;
}
.footersocial {
width: 100%;
display: flex;
justify-content: center;
}
.uk-child-width-1-2>* {
width: 50%;
}
.uk-grid {
display: flex;
/* 1 */
flex-wrap: wrap;
/* 2 */
margin: 0;
padding: 0;
list-style: none;
}
[class*='uk-inline'] {
/* 1 */
display: inline-block;
/* 2 */
position: relative;
/* 3 */
max-width: 100%;
/* 4 */
vertical-align: middle;
/* 5 */
-webkit-backface-visibility: hidden;
}
<div class="photowrapper">
<div class="photo-grid-padding uk-child-width-1-2#l" uk-grid>
<div>
<a class="uk-inline" href="houses.htm">
<img src="img/houses/houses01.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">houses</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="yangshuo.htm">
<img src="img/yangshuo/yangshuo1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">yangshuo</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="nature.htm">
<img src="img/nature/nature1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">nature</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="buildings.htm">
<img src="img/buildings/buildings1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">buildings</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="lasvegas.htm">
<img src="img/lasvegas/lasvegas1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">lasvegas</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="tripinterrupted.htm">
<img src="img/tripinterrupted/tripinterrupted2.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">trip interrupted</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="otherstuff.htm">
<img src="img/otherstuff/other1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">other stuff</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="design.htm">
<img src="img/design/infographic.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">design
<h3>
</div>
</a>
</div>
To let you know: I tried this suggestion:
https://codepen.io/blimpage/embed/obWdgp?default-tab=result&theme-id=dark
and the images lined up perfectly on a test page with no framework added.
But unfortunately when I inserted that solution into my page with the framework, and specifically when I put the display: flex style in the div around my rows in the grid it messed up the alignment of both the framework and the attempted solution, and neither was then working as they should have been.
I have put the HTML and CSS for that attempted solution below.
Any info or knowledge that would make my images align up in their height to create a clean row would help me out. Please if someone could let me know if I am missing something! Also, am a DIY beginner coder, please be gentle with me, I still have lots to learn!
img {
width: 100%;
height: auto;
vertical-align: middle;
}
.picsinarow {
display: inline-flex
}
}
.container {
background: white;
margin: 0 auto;
padding: 5%;
width: 75%;
}
.b1 {
flex: 1.3431
}
.n1 {
flex: 1.3333
}
<div class="photowrapper">
<div class="photo-grid-padding uk-child-width-1-2#l" uk-grid>
<div class="picinarow">
<a class="uk-inline" href="houses.htm">
<img src="img/houses/houses01.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">houses</h3>
</div>
</a>
</div>
<div>
<a class="uk-inline" href="yangshuo.htm">
<img src="img/yangshuo/yangshuo1.jpg" height="1500" alt="">
<div class="centered">
<h3 class="photolink">yangshuo</h3>
</div>
</a>
</div>
<!-- end of pic in a row -->
</div>
<!-- end of photowrapper -->
To be clear, I am no longer using this code as it caused problems once I tried to integrate it into the uikit framework I am using.
Thank you so much!!

Centering a BootStrap well

I am trying to center a Bootstrap Well that says "Resource Booker" within a div so that it aligns properly with the two boxes below it. Ive tried adding padding but it adds padding inside of the well. I provided a picture and my code below.
Page Screenshot
<div class="col-sm-8 text-left">
<br>
<br>
<div class="well well-lg" style="background-color:rgb(0,50,0); color:white;"><h1> Resource Booker </h1> </div>
<br>
<br>
<div class="row">
<div class="column">
<div class="card" id="hi" style="width:400px; height:300px;">
<p><i class="fa fa-user"></i></p>
<h1>Book</h1>
<p>Book A Room</p>
<p> <span class="glyphicon glyphicon-book" style="font-size:150px;"></span></p>
</div>
</div>
<center>
<div class="column">
<br>
</div>
<div class="column">
<div class="card" id="bye" style="width:400px; height:300px;>
<p><i class="fa fa-coffee"></i></p>
<h1>Calender</h1>
<p>Check Availability</p>
<p> <span class="glyphicon glyphicon-calendar" style="font-size:150px;"></span></p>
</div>
</div>
</div>
</div>
</center>
</div>
The CSS for the cards underneath the well is:
/* Float four columns side by side */
.column {
float:left;
width: 27%;
padding: 0px 50px 0px 90px;
}
.row {margin: 0 -5px;}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive columns */
#media screen and (max-width: 600px) {
.column {
width: 100%;
display: block;
margin-bottom: 10px;
}
}
/* Style the counter cards */
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
padding: 16px;
text-align: center;
background-color: #444;
color: white;
}
.fa {font-size:200px;
Try adding the container class wrapped around the div. You can also add margin-left to the same. Further, please add a codepen of your project so that we mobile users can play around for the solution.
If you add margin-left to div then you have to adjust that margin in media query it's better to give max-width to well dive and give them margin: 0 auto and width: 100%.
Your css will like this
.well{max-width: 400px; width: 100%; margin: 0 auto;}

Scalable circles with dynamic numbers inside

Apologies if this has been asked and answered already, as I was not able to find an appropriate solution to this problem.
I need to work on a site navigation that require some numbers to be placed inside circles. The circles will increase in diameter based on the length of the text inside. I'm looking for a very elegant, preferably css only solution for this. Please note the alignment of the circles here with respect to the entire row and label text on the mock up attached.
It required some CSS trickery to get this working, but this works in the latest version Chrome and Firefox. Let me know if you have any other questions.
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
color: #9653DA;
font: 600 14px sans-serif;
}
.nav-table {
display: table;
text-align: center;
}
.nav-row {
display: table-row;
}
.nav-col {
display: table-cell;
}
.text {
margin: 1em;
}
.icon {
display: inline-block;
border-radius: 100%;
border: 2px solid;
min-width: 10px;
padding: 0.5em;
margin: 0.5em;
}
.icon div {
position: relative;
height: 0;
padding: 50% 0;
top: -7px; /* Half of font-size, in our case it is (14px / 2) */
}
<div class="nav-table">
<div class="nav-row">
<div class="nav-col">
<div class="icon">
<div>20</div>
</div>
</div>
<div class="nav-col">
<div class="icon">
<div>300</div>
</div>
</div>
<div class="nav-col">
<div class="icon">
<div>50</div>
</div>
</div>
<div class="nav-col">
<div class="icon">
<div>1</div>
</div>
</div>
</div>
<div class="nav-row">
<div class="nav-col">
<div class="text">Japanese</div>
</div>
<div class="nav-col">
<div class="text">Main Course</div>
</div>
<div class="nav-col">
<div class="text">Non Vegetarian</div>
</div>
<div class="nav-col">
<div class="text">Beginners</div>
</div>
</div>
</div>

Trouble resizing bootstrap 3 box to fit with image

Please see the first image below.
This is working great and is how I want it to look. However when the browser resizes it then looks like this.
As you can see the white background of the text block is bigger than of the image block. I want the image block to be the same height as the text block but unfortunately this is not working. I am using Bootstrap 3 to develop this and you can see my code for this below:
<div class="row" style="margin-bottom:30px;">
<div class="col-xs-12">
<div class="col-sm-3" style="padding:0;">
<img src="core/img/abb[square].jpg" class="img-responsive">
</div>
<div class="col-sm-9" style="background:#fff; height:218px; padding:7px 25px;">
<h2><a class="a-cl">Page title</a> <small>2.1 miles away</small></h2>
<p>Text content, summary of page here.</p>
Subscribed <i class="glyphicon glyphicon-ok" style="margin-left:4px;"></i>
</div>
</div>
</div>
Any help would be much appreciated. As you can see I have manually defined the height on <div class="col-sm-9"> and set height:218px. This obviously will not work dynamically as the page resizes.
Summary: I am looking for an effective way of making sure the height of the text block is the same as the image block using bootstrap 3.
Okay, this is with intrinsic ratios, it's not like the comments I made. However, the comment about the rows and columns and nesting are correct.
DEMO: http://jsbin.com/zodama/1/
http://jsbin.com/zodama/1/edit
Requires: jquery.matchHeight-min.js
https://github.com/liabru/jquery-match-height
jQuery (when the script is installed):
$(document).ready(function() {
$('.my-row [class*="col-"]').matchHeight();
});
The CSS, some of which is the aspect ratio and some of which is Bootstrap grid manipulation based on intimate knowledge of how it works.
.my-row {
border: 10px solid #ddd;
margin-left: 0;
margin-right: 0;
margin-bottom: 3%;
text-align: center;
}
.image img {
display: block;
max-width: 100%;
height: auto;
margin: 0 auto;
}
.my-row [class*="col-"] {
padding:0 0 10px 0;
}
#media (min-width:768px) {
.my-row {
border: 10px solid #ddd; /* remove this it's in the global */
text-align: left;
}
.my-row [class*="col-"] {
padding: 0;
min-height: 220px;
}
.my-row [class*="col-"]:last-child {
padding-left: 20px;
padding-bottom: 20px;
}
.image img {
display: block;
width: 100%;
height: 100%;
margin: auto;
-webkit-transition: all 2s ease-out;
transition: all 2s ease-out;
}
.image img {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.image {
position: relative;
height: 0;
padding-top: 56.25%;
}
}
#media (min-width:992px) {
.my-row [class*="col-"] {
min-height: 250px;
}
}
#media (min-width:1200px) {
.my-row [class*="col-"] {
min-height: 275px;
}
}
HTML
<div class="container">
<div class="row my-row">
<div class="col-sm-4 col-md-3 image">
<img src="http://lorempixel.com/320/320/sports"/>
</div>
<div class="col-sm-8 col-md-9">
<h2><a class="a-cl">Page title</a> <small>2.1 miles away</small></h2>
<p>Text content, summary of page here.</p>
Subscribed <i class="glyphicon glyphicon-ok"></i>
</div>
</div>
<div class="row my-row">
<div class="col-sm-4 col-md-3 image">
<img src="http://lorempixel.com/320/320/city"/>
</div>
<div class="col-sm-8 col-md-9">
<h2><a class="a-cl">Page title</a> <small>2.1 miles away</small></h2>
<p>Text content, summary of page here.</p>
<p>Text content, summary of page here.</p>
<p>Text content, summary of page here.</p>
<p>Text content, summary of page here.</p>
<p>Text content, summary of page here.</p>
Subscribed <i class="glyphicon glyphicon-ok"></i>
</div>
</div>

CSS div's containing classes

So my logic of Div ID's and Classes must be WAY off.
Heres whats going on:
As you can see the blocks which say PS don't align center with the slider (Which is inside a container.
Here is my css:
/*Front Page Buttons */
#frontpage-Button-Cont {
height: 350px;
}
.button-cont {
width: 175px;
float: left;
margin-left: 10px;
margin-top: 10px;
height: 250px;
}
.thumbnail {
color: #fff;
font-size: 5em;
background: #1f4e9b;
width: 175px;
height: 135px;
text-align: center;
}
.pheader {
color: #DC143C;
min-width: 175px;
text-align: center;
}
.paragraph {
text-align: center;
}
#Align-content {
margin: 0 auto;
}
And here is the html:
<div id="frontpage-Button-Cont">
<div id="Align-content">
<div class="button-cont">
<div class="thumbnail">
PS
</div>
<div class="paragraph">
<div class="pheader">
HEADER
</div>
<p>dadaasdasdadadad
</div>
</div>
<div class="button-cont">
<div class="thumbnail">
PS
</div>
<div class="paragraph">
<div class="pheader">
HEADER
</div>
<p>dadaasdasdadadad
</div>
</div>
<div class="button-cont">
<div class="thumbnail">
PS
</div>
<div class="paragraph">
<div class="pheader">
HEADER
</div>
<p>dadaasdasdadadad
</div>
</div>
<div class="button-cont">
<div class="thumbnail">
PS
</div>
<div class="paragraph">
<div class="pheader">
HEADER
</div>
<p>dadaasdasdadadad
</div>
</div>
</div>
</div>
My theory is that I'm using classes incorrectly?
Thanks.
You can Add this to your CSS
#frontpage-Button-Cont {
width:100%;
}
#Align-content {
display:table;
}
With this your margin:o auto can work
View This Demo http://jsfiddle.net/VGPeW/
You need to make sure that the containing div (in this case frontpage-Button-Cont) is the same width as your slider above it. Then add the property text-align:center to the container. That should fix your issue.