Bootstrap columns not floating/wrapping onto next row with flex-box - html

I am trying to make the bootstrap columns of same height using several approaches that I found over here. Everywhere it is working perfectly except the safari on mac, where all the columns stack up in the first row instead of floating to the next one.
here is the HTML:
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6 text-center">
<div class="product_card">
<a href="/buy/handsome-cream-3-pc-jodhpuri-suit"><img alt="Handsome Cream 3 Pc Jodhpuri Suit"
src="/system/images/attachments/000/000/174/normal/open-uri20160927-22035-h7grcj?1474996752"></a>
<div data-target="#loginSignUpModal" data-toggle="modal" onclick="return false;">
<i class="fa fa-star-o" aria-hidden="true"></i> Shortlist
</div>
<a class="caption" href="/buy/handsome-cream-3-pc-jodhpuri-suit">
<h3>Handsome Cream 3 Pc Jodhpuri Suit</h3>
<span class="price">$380.00</span>
</a></div>
</div>
</div>
here is the CSS that is being used:
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
&> [class*='col-'] {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
}
here is the screenshots on MAC SAFARI:
here is the screenshots on Ubuntu Chrome:
Why is safari goofing up with my col-mds? How to fix this without using JS?

I think the easier way to do it is by setter the height you want in CSS, remove the img tag, and add a background cover image on your first a tag:
.product_card {
height: 300px;
width: 190px;
float: left;
margin: 4px;
}
.product_card a:first-child {
display: block;
height: 100%;
background-image: url('http://i.imgur.com/8YsAmq3.gif');
background-position: center center;
-webkit-background-size: cover;
background-size: cover;
}
.product_card:first-child {
margin-left: 0px;
}
.product_card:last-child {
margin-right: 0px;
}
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6 text-center">
<div class="product_card">
<div data-target="#loginSignUpModal" data-toggle="modal" onclick="return false;">
<i class="fa fa-star-o" aria-hidden="true"></i> Shortlist
</div>
<a class="caption" href="/buy/pork">
<h3>Porks</h3>
<span class="price">$380.00</span>
</a></div>
<div class="product_card">
<div data-target="#loginSignUpModal" data-toggle="modal" onclick="return false;">
<i class="fa fa-star-o" aria-hidden="true"></i> Shortlist
</div>
<a class="caption" href="/buy/rhinoceros">
<h3>Rhinoceros</h3>
<span class="price">$8 000.00</span>
</a></div>
<div class="product_card">
<div data-target="#loginSignUpModal" data-toggle="modal" onclick="return false;">
<i class="fa fa-star-o" aria-hidden="true"></i> Shortlist
</div>
<a class="caption" href="/buy/dog">
<h3>Dogs</h3>
<span class="price">$380.00</span>
</a></div>
</div>
</div>

Related

How to display items aligned?

this is for sure a common question but text-align and display properties are not solving it, so i must have some mistake.
What should i do to display the 3 items in the same horizontal line?
.contact__information {
vertical-align: middle;
margin-bottom: var(--mb-1);
padding-right: var(--mb-.75);
align-items: right;
text-align: center;
display: inline-flex;
margin-left: auto;
margin-right: auto;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>
Step 1: Define width
Step 2: Locate parent to flex - #contact
Step 3: align-items: center; makes all elements inline (aligned)
Step 4: justify-content: space-evenly; spaces all elements evenly. Using up extra space.
#contact {
width: 100%;
display: flex;
align-items: center;
justify-content: space-evenly;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>
Feels like an opportunity for flex. I added borders and padding just to make it obvious what was where and did some alignment you can customize as needed
.contact.section {
display: flex;
flex-direction: row;/* or column if you want the first two on top */
justify-content: flex-start;
align-items: center;
}
.contact__information,
.contact__information div { /*probably need a class for the div */
display: flex;
flex-direction: row;
justify-content: center;
border: solid 1px lime;
padding:0.25rem;
}
.contact__information div {
display: flex;
flex-direction: column;/* or row if titles are in line with data */
border: solid 1px pink;
}
.contact__title {
border: solid blue 1px;
padding: 0.5rem;
align-self: center;
}
.contact__subtitle {
border: solid #8d8dff 1px;
padding: 0.5rem;
align-self: center;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>

How to remove Space CSS overflow-x in mobile design

I try to make a slide card for mobile design by implement overflow-x.
However, this leaves some space on the right side of the screen which is really annoying. How can I fix this?
I have used the following style to get rid of the extra space on the right side of the screen:
Here is my html code
<div class="pet-group">
<!-- Pet List Widget -->
<div class="row justify-content-md-center text-center flex-nowrap2">
<div class="w-25 p-3" data-step="2" data-intro="You also can add your other pet!" data-position='right'
data-scrollTo='tooltip'>
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content ">
<div class="pet-info-widget ">
<a href="add-pets.html" class="booking-doc-img ">
<img src="assets/img/addpet.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="add-pets.html " class="stretched-link ">
Add Pet </a> </h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="w-25 p-3" data-step="1"
data-intro="Hey, its Ricky! You can click here to view or update your pet story." data-position='left'>
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content ">
<a href="profile-pet.html" class="booking-doc-img ">
<div class="pet-info-widget ">
<img src="assets/img/pets/cat1.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="profile-pet.html" class="stretched-link ">
Ricky </a><span class="badge badge-pill bg-success-light gender">Male</span></h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="w-25 p-3">
<div class="card widget-profile pet-widget-profile ">
<div class="card-body card-mobile">
<div class="propet-widget-content">
<a href="profile-pet.html" class="booking-doc-img ">
<div class="pet-info-widget ">
<img src="assets/img/pets/cat2.png " alt="users Image ">
</a>
<div class="profile-det-info ">
<h3><a href="profile-pet.html" class="stretched-link ">
Bucky </a><span class="badge badge-pill bg-warning-light gender">Female</span></h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Here is my css code
.pet-group {
margin-top: -70px;
display: flex !important;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
scroll-direction: horizontal;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
display: none;
}
}
.flex-nowrap2 {
padding: 15px;
list-style: none;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: nowrap;
flex-wrap: nowrap;
}
Try
.flex-nowrap2 {
padding-right: 0px;
}
inside Mobile Size Media Query.
remove padding
.flex-nowrap2 {
padding: 0;
}
If you want padding to text just add padding to title tags only.

How to move third element in block down with flexbox?

How move third element down, that first block with logo, and second other full width contain another panel,and down will be another panel?
this block (pastenow.ru/57IX6) need to move and it must be like this : pastenow.ru/57IXE
<nav class="navbar">
<!--start of top_panel-->
<div class="logo"><img src="img/logo.png" alt=""> </div>
<div class="panel">
<div class="nav_title">С нами ловят все!</div>
<div class="phone">8 800 553535</div>
<div class="address_wrapper">
<div class="address">Павлодар, ул. Мира 7</div>
<div class="address">Павлодар, ул. Мира 8</div>
</div>
<div class="call_btn def_btn">Заказать звонок</div>
</div>
<!--end of top_panel-->
<!--start of bottom_panel-->
<div class="bottom_panel">
<div class="main">Главная</div>
<div class="about_us">компании</div>
<div class="tournament">Турниры</div>
<div class="goods">Товары</div>
<div class="news">Новости</div>
<div class="photo">Фото</div>
<div class="video">Видео</div>
<div class="contact">Контакты</div>
<div class="social_icons_wrapper">
<div ><i class="fa fa-youtube icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-instagram icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-vk icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-whatsapp icon_size" aria-hidden="true"></i></div>
<div><i class="fa fa-telegram icon_size" aria-hidden="true"></i></div>
</div>
</div>
<!--end of bottom_panel-->
if add flex-wrap: wrap; so all goes down, but i need only one.
css
.container{
width: 1170px;
height: auto;
min-height: 100vh;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: auto;
font-family: "Museo Cyrl 900";
}
.header_line{
width: 100%;
height: 122px;
background-color: #fff;
}
.navbar{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.logo{
width: 200px;
height: auto;
}
.panel{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.bootom_panel{
width: 100%;
display:inline-flex;
justify-content: flex-end;
}
I have made a codepen demo with slight adjustments in the layout which you have provided. Please click on this link: https://codepen.io/ArunK_UI/pen/qwbXLm?editors=1100
Major change here is I have wrapped upper panel and lower panel in one wrapper and then gave them respective properties.
<div class="panel-wrap">
<div class="panel"></div>
<div class="bottom_panel"></div>
</div>

Building a responsive "centered icons with descriptions" layout

Here's a quick mockup of a layout that I'd like to build:
How would you do this? I've been playing around with flexbox-based solutions for a bit, but I haven't been able to make it work yet.
Some additional caveats:
To make the design responsive, I want to use some Bootstrap-like grid system to split the items over multiple rows on smaller screens. I'm currently using Pure CSS, but I'm open to alternatives including custom media queries.
Ideally I'd load the icons inside the bubbles from SVG assets. I know I can make four bubble-shaped icons, pop 'em in as <img> tags and then horizontally center them with the text, but that's probably not the most elegant solution.
The four "icon with description" columns should be vertically centered towards one another. Although this is not visible here, it'll affect the layout when the text doesn't line up as neatly as in my mockup.
Check this StackBlitz: FlexBox example
In the example I'm using flexbox. If you change the size of the browser window you will see how the icons break down into the next line (responsive).
HTML file:
<div class="container">
<div class="item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x icon-background"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
<p>Description</p>
</div>
<div class="item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x icon-background"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
<p>Description</p>
</div>
<div class="item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x icon-background"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
<p>Description</p>
</div>
<div class="item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x icon-background"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
<p>Description</p>
</div>
</div>
CSS file:
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
}
.icon-background {
color: #c0ffc0;
}
I really enjoy using flexbox, and I think it is not necessary to use bootstrap or other frameworks. Just using flexbox you have a responsive layout with few lines.
I used the <img> tag, but you can use the CSS tag background.
Just look at this simple example that I have done. Starting with it you can adapt to your mockup can do whathever it's necessary.
.father {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
.element {
color: #000;
text-align: center;
}
.element .element-circle {
border-radius: 50%;
overflow: hidden;
background-color: #fdcb6e;
padding: 2rem;
}
.element .element-image {
background: url('https://image.flaticon.com/icons/svg/149/149315.svg');
width: 80px;
height: 80px;
padding: 15px;
}
.element p {
font-weight: bold;
}
<div class="father">
<div class="element">
<div class="element-circle"><div class="element-image"></div></div>
<p>Lorem Ipsum</p>
<span>Subtitle</span>
</div>
<div class="element">
<div class="element-circle"><div class="element-image"></div></div>
<p>Lorem Ipsum</p>
<span>Subtitle</span>
</div>
<div class="element">
<div class="element-circle"><div class="element-image"></div></div>
<p>Lorem Ipsum</p>
<span>Subtitle</span>
</div>
<div class="element">
<div class="element-circle"><div class="element-image"></div></div>
<p>Lorem Ipsum</p>
<span>Subtitle</span>
</div>
</div>
More info of flexbox you can find in this guide.

Bootstrap put container in container fluid

I want to make two different column background, for that I set container-fluid, and make two columns, and make another row.. but It don't want to work.
I need like this (PHOTO)
Here is my code
<section id="mid">
<div class="container-fluid mid">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-6 left">
<div class="container">
<h2>Inovative macaroons</h2>
<div class="media">
<div class="media-left">
<a href="#">
<span class="fa-stack fa-2x media-object">
<i class="fa fa-circle fa-stack-2x bg"></i>
<i class="fa fa-tag fa-stack-1x fa-inverse"></i>
</span>
</a>
</div>
<div class="media-body">
<h3 class="media-heading">Best Prices</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce malesuada et.</p>
</div>
</div>
</div>
</div>
<div class="col-md-6 right">
<h2> Specials</h2>
</div>
</div>
</div>
</div>
</div>
</section>
In "left" css I made white BG, and In right I made pink.
Use flex css to achieve this. If i am understanding you right, you want both columns to have same height as the one column with the largest height due to text.
Add the following css in your code
.flex-row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-row > [class*='col-'] {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
Then apply the flex-row to the row containing the left and right colomns
<div class="row flex-row">
<div class="col-md-6 left">
<div class="container">
Hope this helps.