Remove space between divs vertically [Bootsrap 3] - php

I need to remove space between some div and div below that div. Space created if some div is higer then other in column.
Here is example:
http://www.bootply.com/Hc2aO5o4bG
basicly I need to remove space between 1. and 4. post and 2. and 5. and for each other posts that have space below them.
Also post should be in this order:
1. 2. 3.
4. 5. 6.
7. .....
Here is what I trying to accomplish:

Give a clear before 4:
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 columns: iq_id, iq_pitanje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 cssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssolumns: iq_id, iq_pit
anje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 columns: iq_id, iq_pitanje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
<div class="clear"></div>
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 columns: iq_id, iq_pitanje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 columns: iq_id, iq_pitanje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
<div class="col-xs-12 col-md-4 hover">
<!-- post thumbnail -->
<!-- /post thumbnail -->
<div class="content">
<h4>IQ test [PHP & MySQL]</h4>
<p>
</p><p>We have 4 columns: iq_id, iq_pitanje, iq_odgovor and iq_tacan. iq_tacan contains true answer.</p> <a class="post-edit-link" href="http://tuts.masterize.me/wp-admin/post.php?post=1284&action=edit">Edit This</a> <p></p>
</div>
<a href="http://tuts.masterize.me/2014/06/24/iq-test-php-mysql/">
<div class="link">
<i class="fa fa-link"></i>
</div>
</a>
</div>
And give this CSS
.clear {
clear: both;
}
Technically, you must give the .clear every three rows, in your case!
Preview: http://www.bootply.com/uC3qzah3f9
For a dynamic solution:
/* Start Praveen's Reset for Fiddle ;) */
* {font-family: 'Segoe UI'; margin: 0; padding: 0; list-style: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
/* End Praveen's Reset for Fiddle ;) */
.posts {overflow: hidden;}
.posts .post {border: 1px solid #999; padding: 10px; text-align: center; width: 32%; margin: 0.5%; float: left;}
.posts .post:nth-child(3n+4):before {clear: both; display: block; content: " ";}
<div class="posts">
<div class="post">Post #1</div>
<div class="post">Post #2</div>
<div class="post">Post #3</div>
<div class="post">Post #4</div>
<div class="post">Post #5</div>
<div class="post">Post #6</div>
<div class="post">Post #7</div>
<div class="post">Post #8</div>
<div class="post">Post #9</div>
<div class="post">Post #10</div>
<div class="post">Post #11</div>
<div class="post">Post #12</div>
<div class="post">Post #13</div>
<div class="post">Post #14</div>
<div class="post">Post #15</div>
</div>
In the above case, you need to manually change the CSS: (3n + 4). I gave + 4 to not include the 1st child.

You should be wrapping your rows with <div class="row"></div>: http://getbootstrap.com/css/#grid
You can also set a min-height property to something like 141px so that the borders line up.

Related

How can i set a height to div according to step by step div

When i am listing products i want them to have fixed height according to its step by step div's max height. For example below there is a screenshot from amazon that has what i want. All 4 elements' height are same.
and i'm using the code below to list products
<div class="shop-product-wrap">
<div class="row row-8">
<?php foreach ($products as $product): ?>
<div class="product-col col-lg-3 col-md-4 col-sm-6">
<!-- Single Product Start -->
<div class="single-product-wrap mt-10">
<div class="product-image">
<a href="<?= $product['url'] ?>"><img class="lazy"
src="<?= public_url('images/other/thumbnail.jpg') ?>"
data-src="<?= image_url($product['image_small']) ?>"
alt=""></a>
</div>
<div class="product-button">
<a onclick="wishlist.add(<?= $product['product_id'] ?>)"
class="add-to-wishlist">
<i class="icon-heart"></i></a>
</div>
<div class="product-content">
<h6 class="product-name"><?= $product['product_name'] ?>
</h6>
<div class="starts-icon-box">
<i class="stars-icon"></i>
</div>
<div class="price-box">
<div class="single-product-discount-and-price">
<?php if ($product['product_discount_price']): ?>
<span class="onsale"><?= (100 - (round(($product['product_price'] * 100) / $product['product_discount_price']))) . '%' ?></span>
<?php endif; ?>
<div class="old-and-new-price">
<span class="old-price"><?= $product['product_discount_price'] ?> TL</span>
<span class="new-price"><?= number_format($product['product_price'], 2) ?> TL</span>
</div>
</div>
</div>
<div class="product-button-action">
<a onclick="cart.add(<?= $product['product_id'] ?>,1)"
class="add-to-cart">Add to cart</a>
</div>
</div>
</div>
<!-- Single Product End -->
</div>
<?php endforeach; ?>
</div>
</div>
and when i listing products they all take the height they can according to their content such as its name and so that they don't have the same height. How can i make them have same height step-by-step.
Sorry for my bad english.
You have to use div tag with same class name for every product item and add a parent div like this...
<div class="parent">
<div class="child">Item 1</div>
<div class="child">Item 2</div>
<div class="child">Item 3</div>
<div class="child">Item 4</div>
</div>
Then use flex box for parent and child element...
.parent{
display: flex;
flex-wrap: wrap;
align-content: stretch;
height: 600px; /*or something*/
}
.child{
background-color: #f1f1f1;
width: 100px;
margin: 10px;
text-align: center;
line-height: 75px;
font-size: 30px;
}
Please visit those links for more information about flex box...
https://www.w3schools.com/css/css3_flexbox.asp
https://www.w3schools.com/css/tryit.asp?filename=trycss3_flexbox_align-content_stretch

How to redirect toa particular section of a different html page which has owl carouselin it

I want to redirect the user to a particular section of an html page.
// javascript for owl
$(document).ready(function(){
$('.owl-two').owlCarousel({
loop:true,
margin:10,
nav:true,
autoplay:true,
responsive:{
0:{
items:1
},
600:{
items:2
},
1000:{
items:3
}
}
});
});
<!-- nav-->
<ul class="dropdown-menu">
<li>Hair</li>
<li>Nail</li>
<li>Wax</li>
</ul>
<!-- owl carousel in salon services page-->
<div id="nail" class="row" >
<br>
<br>
<h3 class="text-center">Our Nail Services</h3>
<br>
<!-- nail carousal-->
<div class="owl-two owl-carousel owl-theme">
<div class="item"><img src="images/n1.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Manicure</h4>
</div>
<div class="item"><img src="images/n2.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Pedicure</h4>
</div>
<div class="item"><img src="images/n3.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Nail Painting and Design</h4>
</div>
<div class="item"><img src="images/n4.jpg" alt="Image" class=" img-thumbnail">
<h4 class="text-center">Nail Extensions</h4>
</div>
</div>
I want to redirect the user directly from nav dropdown to another page's div containing that content. The page to which I want to redirect has 3 owl carousels.
I have already tried the html id redirect. <a href="#id">, but it does not works completely. The page redirects briefly to the section but scrolls automatically to the top of the page.
I am using the owl carousel and think that owl javascript is the responsible factor for this as I have tested it with removing owl and it works, also the id redirect works fine when done from the same page (i.e.services page ).
I have 3 carousels 1.hair 2.nail 3.wax
Kindly help I want to keep owl and the section redirect function. Thanks.
.sec {
width: 100%;
height: 100vh;
background-color: #ccc;
margin-bottom: 12px;
}
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
</ul>
<div id="one" class="sec">
<h1>One</h1>
</div>
<div id="two" class="sec">
<h1>Two</h1>
</div>
<div id="three" class="sec">
<h1>Three</h1>
</div>
<div id="four" class="sec">
<h1>Four</h1>
</div>

Why PHP include Not Hidden inside the div with bootstrap 4

I Used Php include to include the info inside of the modals for the albums and for some reason its including the correct file but its not hidden as i specified in the div class where I have included it. you can visit the music page on https://www.trillumonopoly.com but here is the code for the music page where i included the musicmodals.php info page. Funny thing is it doesnt display all of the content. just the very last div. why is this even visible? How can I fix? I cant include the code of the music modal page ... too much for the text area... but
<html>
<head>
<style>
.general {
background : url("img/parallaxmain1.jpg") repeat fixed 100% !Important;
background-size: cover;
}
.album {
width: 90%;
height: 650px;
margin:0 auto;
overflow-x: auto;
overflow-y: hidden;
background : url("img/featured.jpg") repeat fixed 80% !Important;
background-size: cover;
}
.songlist {
width: 85%;
margin: 0 auto;
font-size: 90% !important;
height: 200px:
overflow-x: auto;
overflow-y: hidden;
}
.albumback {
background : url("img/featured.jpg") repeat fixed 80% !Important;
background-size: cover;
}
</style>
</head>
<body><center><font size="2em">
<div class="general">
<div class="header">
<div class="col-6 ">
<img src="img/mediahead.png" class="img-fluid">
</div>
<div class="col-6 ">
</div>
</div>
<div class="discography row container">
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#BlueLines" data-lity>
<img src="music/011BlueLines/bluelines.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: BLUE LINES & BIG FACES<br>
Release: 2015<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#YungNGettinIt" data-lity>
<img src="music/010YungNGettinIt/yung.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: Yung N Gettin It<br>
Release: 2014<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#RNL" data-lity>
<img src="music/009RNL/rnl.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: RNL<br>
Release: 2014<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#GodsHand" data-lity>
<img src="music/008GodsHand/godshand.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: GodsHand<br>
Release: 2013<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#AG" data-lity>
<img src="music/007IAmAG/IamAGFront.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: ZAREYAH <br>
Title: I AM A G<br>
Release: 2011<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#KeepItG" data-lity>
<img src="music/006KeepItG/keepItGFront.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: Keep It G<br>
Release: 2012<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#Gunsmoke" data-lity>
<img src="music/005GunsmokeNResin/gunsmoke.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: GunsSMoke & Resin<br>
Release: 2011<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#Divine1" data-lity>
<img src="music/004DGvol1/DGvol1front.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: Divine Grind <br>
Title: Vol. 1<br>
Release: 2010<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#PotentAlbum" data-lity>
<img src="music/003PotentAlbum/potentalbumfront.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: The Potent Album<br>
Release: 2006<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#2Potent" data-lity>
<img src="music/002The2PotentAlbum/toopotentalbumfront.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: 2 Potent Album<br>
Release: 2005<br>
</div><br>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 box2"><br>
<a href="#DoinNumbers" data-lity>
<img src="music/001DoinNumbers/DoinNumbersFront.jpg" class="img-fluid">
</a>
<hr style="background-color:#ffffff"><br>
<div class="video description">
Artist: T. Cartel <br>
Title: Doin Numbers<br>
Release: 2005<br>
</div><br>
</div>
</div>
</div>
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7512006871298343"
data-ad-slot="7265345115"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!--footer-->
© ILLUMONOPOLY LLC. ALL RIGHTS RESERVED. </center>
<div class="d-none invisible">
<?php include("/customers/b/b/3/trillumonopoly.com/httpd.www/pages/musicmodals.php");?>
</div>
</body>
</html>
An extra closing was before the last modal allowing it to close the last div that contained all the modals. Simply removed the closing and all the content became hidden.

Modifying a Wordpress template to show an excerpt with an image

I'm modifying my Wordpress template to show an excerpt just below the header with some text, social sharing buttons and a image (kind of a biography).
I have almost all the code but the image doesn't appear. I guess is a pretty simple mistake and someone can help me easily.
Here's my code. Most of the code is copied and adapted to my own theme because I don't know pretty anything about web oriented lenguages like PHP or HTML.
<!-- BEGIN .sixteen columns -->
<div class="sixteen columns">
<!-- BEGIN .featured-page -->
<div class="featured-page">
<div itemscope itemtype="http://data-vocabulary.org/Person">
<!-- BEGIN .eleven columns -->
<div class="eleven columns">
**<div class="feature-img iphone-profile" style="background-image: url(http://www.example.png);"></div>**
<div class="article">
<h2 class="title">About me</h2>
<p>*Some text here*.</p>
</div>
<div class="home-social">
<div class="title">Follow Me</div>
<ul class="social-icons">
<li><a class="link-twitter" href="https://twitter.com" target="_blank"><span aria-hidden="true" class="organicon-twitter"></span></a></li>
<li><a class="link-linkedin" href="http://pl.linkedin.com/in/" target="_blank"><span aria-hidden="true" class="organicon-linkedin"></span></a></li>
<li><a class="link-google" href="http://plus.google.com/1" target="_blank"><span aria-hidden="true" class="organicon-googleplus"></span></a></li>
<li><a class="link-email" href="example" target="_blank"><span aria-hidden="true" class="organicon-envelop"></span></a></li>
</ul> </div>
<!-- END .eleven columns -->
</div>
<!-- BEGIN .five columns -->
<div class="five columns">
**<div class="feature-img desktop-profile" style="background-image: url(http://www.example.png);"></div>**
<!-- END .five columns -->
</div>
<span style="display: none;" itemprop="name">Example</span>
<span style="display: none;" itemprop="organization">Example</span>
<span style="display: none;" itemprop="role">Example</span>
<img style="display: none;" itemprop="image" src="http://example.png" />
</div>
<!-- END .featured-page -->
</div>
</div>
<!-- END .sixteen columns -->
The first thing you should try is deleting the style="display: none;" in your
<img style="display: none;" itemprop="image" src="http://example.png" />
It should look like:
<img itemprop="image" src="http://example.png" />

Displaying parent div horizontally beyond width of page

<div class="parent">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
The height of the child class is 20% and the width 200px.
What I'm wondering is how to make it so that when I have, for example, 20 parent divs it is set up so that they are all displayed horizontally, beyond the width of the page, so that I have to scroll left or right to view the data. At the moment it fills the width of the page and starts the next parent div underneath the first one so that I have to scroll vertically and I can't fathom how to rectify this problem.
Thanks in advance.
To do this you need to create a parent container, and then assign a overflow-x: scroll css rule to it. You will also need to assign a display: inline-block rule to your parent class. You also need to apply white-space: nowrap;.
DEMO http://jsfiddle.net/qujyunn4/
.wrapper {
overflow-x: scroll;
white-space: nowrap;
}
.parent {
display: inline-block;
width: 200px;
height: 300px;
border: red solid thin;
margin-right: 5px;
white-space: nowrap;
}
<div class="wrapper">
<div class="parent">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
<div class="parent">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
<div class="parent">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
<div class="parent">
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
<div class="child">
</div>
</div>
</div>

Categories