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.
Related
I have a single section in all my HTML, where I need to use flexboxes. The below CSS is affecting all the rows and columns in my HTML. I need the below CSS code only to affect the HTML I have posted here.
How can I make that happen?
Best regards
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.row>[class*='col-'] {
display: flex;
flex-direction: column;
}
<div class="section">
<div class="bestseller-wrap">
<div class="row">
<div class="col-sm-3" style="background-color: aqua;">
<h3>Here is a headline</h3>
<input type="submit" value="Subscribe">
</div>
<div class="col-sm-9">
<img src="/img/test.jpg">
</div>
</div>
</div>
</div>
Use .bestseller-wrap .row and .bestseller-wrap .row>[class*='col-'] as selectors to only affect the rows and columns in this element.
If you need to tie it to the section itself, apply a class to the section in HTML and use that class instead of .bestseller-wrap
.bestseller-wrap .row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.bestseller-wrap .row>[class*='col-'] {
display: flex;
flex-direction: column;
}
<div class="section">
<div class="bestseller-wrap">
<div class="row">
<div class="col-sm-3" style="background-color: aqua;">
<h3>Here is a headline</h3>
<input type="submit" value="Subscribe">
</div>
<div class="col-sm-9">
<img src="/img/test.jpg">
</div>
</div>
</div>
</div>
Just add a class!
.section-headline .row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.section-headline .row>[class*='col-'] {
display: flex;
flex-direction: column;
}
<div class="section section-headline">
<div class="bestseller-wrap">
<div class="row">
<div class="col-sm-3" style="background-color: aqua;">
<h3>Here is a headline</h3>
<input type="submit" value="Subscribe">
</div>
<div class="col-sm-9">
<img src="/img/test.jpg">
</div>
</div>
</div>
</div>
<div class="row">
<h5>A different row</h5>
</div>
Updated Position I have a problem I can't seem to centralize my contact information. Below is the code I have that pushes all the small logos with the text to the side of the webpage.
However, my final goal is to have them placed in one line. Any help is welcome!
.media {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start
}
.media-body {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1
}
<section class="contact-section">
<div class="col-lg-3 offset-lg-1">
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-home"></i></span>
<div class="media-body">
<h3>Buttonwood, California.</h3>
<p>Rosewoodly, PA 750918</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-tablet"></i></span>
<div class="media-body">
<h3>+2 257 995 2885</h3>
<p>Mon to Fri 7am to 6pm</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-email"></i></span>
<div class="media-body">
<h3>support#testemail.com</h3>
<p>Send us a message anytime!</p>
</div>
</div>
</div>
Here you are using flexbox. If you want all children to be in one line.
Just wrap around one more div to all and give it display:flex
<section class="contact-section">
<div class="col-lg-3 offset-lg-1">
<div class="media-wrapper">
<div class="media contact-info"></div>
<div class="media contact-info"></div>
<div class="media contact-info"></div>
</div>
</div>
</section>
and then add following css
.media-wrapper {
display:flex;
}
https://codepen.io/ksilentstorm/pen/eYmeXvr
For knowledge purpose
Just adjust child elements by putting following lines in parent css that is .media-wrapper.
For horizontal alignment - justify-content: center/flex-start/flex-end;
For vertical alignment align-items: center/flex-start/flex-end;
For direction flex-direction: row or flex-direction: column
Note: When direction changes justify-content and align-items both exchange its nature.
For more info. you can visit.
https://www.w3schools.com/css/css3_flexbox.asp
Try this
.media {
/* display: -webkit-box; */
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
float: left;
text-align: center;
margin: 0 17px;
}
.media-body {
width: 100%;
}
<section class="contact-section">
<div class="col-lg-3 offset-lg-1">
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-home"></i></span>
<div class="media-body">
<h3>Buttonwood, California.</h3>
<p>Rosewoodly, PA 750918</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-tablet"></i></span>
<div class="media-body">
<h3>+2 257 995 2885</h3>
<p>Mon to Fri 7am to 6pm</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-email"></i></span>
<div class="media-body">
<h3>support#testemail.com</h3>
<p>Send us a message anytime!</p>
</div>
</div>
</div>
Restructured your HTML code and styled using flex.Hope this helps you.
<section>
<div class="contact-section">
<div class="address">
<span class="contact-info__icon"><i class="ti-home"></i></span>
<div class="media-body">
<h3>Buttonwood, California.</h3>
<p>Rosewoodly, PA 750918</p>
</div>
</div>
<div class="contactInfo">
<span class="contact-info__icon"><i class="ti-tablet"></i></span>
<div class="media-body">
<h3>+2 257 995 2885</h3>
<p>Mon to Fri 7am to 6pm</p>
</div>
</div>
<div class="email">
<span class="contact-info__icon"><i class="ti-email"></i></span>
<div class="media-body">
<h3>support#testemail.com</h3>
<p>Send us a message anytime!</p>
</div>
</div>
</div>
Css change
.contact-section{ display:flex;}
I need a vertical divider and the text to line up exactly like this on the top right hand corner of my screen.
I am having some trouble even getting the divider to show and the text to pull right
<div class="row">
<div class="float-right">
<span>Profile & Settings</span>
</div>
<div class="float-right sep">
<div class="septText"></div>
</div>
<div class="float-right">
<span>Logout</span>
</div>
</div>
Css
.sep {
display: flex;
flex-direction: column;
justify-content: center;
}
.sepText {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex: 1;
}
.sepText::before,
.sepText::after {
content: '';
flex: 1;
width: 1px;
background: currentColor;
/* matches font color */
margin: .25em;
}
I can see that bootstrap 4 tag is added to your question. If you are using bootstrap 4, there is a in-built flex utility https://getbootstrap.com/docs/4.0/utilities/flex/
<div class="d-flex flex-row justify-content-end">
<div class="">
<span>Profile & Settings</span>
</div>
<div class="mx-2">|</div>
<div class="">
<span>Logout</span>
</div>
</div>
JS Fiddle: https://jsfiddle.net/8p27xwcs/
use "container" instead of "row", or set display:inline or block on the row div.
<div class="row" style="display:inline;" >
<div class="float-right">
<span>Profile & Settings</span>
</div>
<div class="float-right sep">
<div class="septText"></div>
</div>
<div class="float-right">
<span>Logout</span>
</div>
</div>
or
<div class="container">
<div class="float-right">
<span>Profile & Settings</span>
</div>
<div class="float-right sep">
<div class="septText"></div>
</div>
<div class="float-right">
<span>Logout</span>
</div>
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>
I have the following list that shows: one icon, a user pic, name, and 2 icons on the left.
I cannot align then properly in ionic, even when I add styling I cannot fix them.
Can you please give me a hint how to make this item be inline in the order I mentioned above?
<div class="list">
<a class="item item-icon-left item-icon-right" href="#" style="margin-top:40px;">
<i class="icon ion-person"></i>
<img class="circular-image" src="/Content/img/bill.jpg" />
<h2 style="display:inline; padding-left:10px;">F.joe</h2>
<i class="icon ion-chatbubble-working"></i>
</a>
<a class="item item-icon-left item-icon-right" href="#">
<i class="icon ion-person"></i>
<img class="circular-image" src="/Content/img/bill.jpg" />
<h2 style="display:inline; padding-left:10px;">F.joe</h2>
<i class="icon ion-chatbubble-working"></i>
</a>
</div>
I would suggest using Ionic's grid CSS component:
http://ionicframework.com/docs/components/#grid
Try something like this:
<ion-list>
<ion-item>
<div class="row">
<div class="col">
<i class="icon ion-person"></i>
</div>
<div class="col">
<img class="circular-image" src="/Content/img/bill.jpg" />
</div>
<div class="col">
<h2>F.joe</h2>
</div>
<div class="col">
<i class="icon ion-chatbubble-working"></i>
</div>
</div>
</ion-item>
</ion-list>
You can mess with the row and col classes to give your list your desired look and feel. For example "col col-25" will make that column take up 25% of the screen.
Another option is to use the flexbox to align the items inside the item, defining three sections .item-content-left, item-content-center (with flex-grow to expand) and .item-content-right
but for something simpler I would take Jake Stewart approach.
<div class="list">
<a class="item" href="#" >
<div class='item-content'>
<div class='item-content-left'>
<i class="icon ion-person"></i>
</div>
<div class='item-content-center'>
<img class="circular-image" src="/Content/img/bill.jpg" />
<h2 >F.joe</h2>
</div>
<div class='item-content-right'>
<i class="icon ion-chatbubble-working"></i>
<i class="icon ion-chatbubble-working"></i>
</div>
</div>
</a>
</div>
CSS
.item-content{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
align-items: flex-start;
-webkit-align-items: flex-start;
}
.item-content-left{
}
.item-content-right{
}
.item-content-center{
flex-grow: 1;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
align-items: flex-start;
-webkit-align-items: flex-start;
}
http://jsfiddle.net/6Lvu98pb/3/