I have made a bootstrap card in my website, and i want to make it horizontal.
and i want to convert it to .
Please provide solution by inspecting my code!
.blue-bg{
background-image: linear-gradient(#1385de,#045f9b);
color: white;
}
.brown-bg{
background-image: linear-gradient(#f8b949,#f7951f);
}
.order-btn2{
background-image: linear-gradient(#ffde5e,#fdd215);
color: black;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<li class="card col-sm-3">
<img class="card-img-top" src="https://i.ibb.co/Tcn9qV7/phoneSms.png" alt="Card image">
<div class="card-header brown-bg">
SMS Order
</div>
<div class="card-body blue-bg p-0 mt-1">
<p class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit.</p>
Place Order
</div>
</li>
Thanks.
Basically bootstrap has inbuilt solution to it its Horizontal Card you can make card both in horizontal and vertical.
Here is a simple example for horizontal card.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card mb-3" style="max-width: 540px;">
<div class="row no-gutters">
<div class="col-4">
<img src="https://via.placeholder.com/150" class="card-img" alt="...">
</div>
<div class="col-8">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
</div>
Related
I'm trying to change the order of columns on sm resolutions/devices in Bootstrap 4.1 but unfortunately nothing is happening. I'm using order prefix for Bootstrap 4.1. My html code looks like this. Can somebody help?
<div class="container-fluid office-spaces">
<div class="col-md-12 col-xs-12 first-layout">
<div class="col-md-6 order-2 order-md-1">
<div class="office-spaces-slider">
<div class="img-wrapper">
<img class="img-responsive" src="theme/images/interior2.jpg" alt="interior2">
</div>
</div>
</div>
<div class="col-md-4 order-1 order-md-2">
<div class="col-md-6 col-xs-12">
<hr>
<h3>OFFICE SPACES</h3>
</div>
<div class="col-md-6 col-xs-12">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed iaculis nibh
nibh, quis vehicula neque suscipit at. Sed dictum, sapien ut sagittis posuere,
massa metus vulputate lorem, ac egestas erat ante et lorem. Aenean facilisis
tincidunt lectus, tristique egestas erat fermentum nec. Vivamus vestibulum
metus et dui posuere convallis.
</p>
</div>
</div>
<div class="col-md-2 empty order-3 order-sm-3"></div>
</div>
</div>
In bootstrap 4, the column formats are as follows:
col-* --> mobile portrait mode
col-sm-* --> mobile landscape mode
col-md-* --> ipad portrait mode
col-lg-* --> ipad landscape mode
col-xl-* --> laptop mode,desktop modes
So you should use below format to be responsive in all devices:
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
</div>
and also always put the .row class after the .container class line:
<div class="row">
//ur column classes goes here
</div>
Using Bulma css framework, I try to make the notification box popup at about the center of the page, without interrupting existing data (it is a notification that pops for 3 seconds and then it should disappear). For example: 2 images on top of each other(snippet 1), and I want the notification box to float on top of them without pushing any content(snippet 2)
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
</div>
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
</div>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
<div class="notification is-primary">
<button class="delete"></button> Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam
gravida purus diam, et dictum <a>felis venenatis</a> efficitur. Sit amet, consectetur adipiscing elit
</div>
</div>
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
</div>
Simply give the notification position: absolute along with a z-index which is higher than the element you want it to sit on top of (1 will likely work fine):
.notification.is-primary {
position: absolute;
z-index: 1;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css" rel="stylesheet" />
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
<div class="notification is-primary">
<button class="delete"></button> Primar lorem ipsum dolor sit amet, consectetur adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam
gravida purus diam, et dictum <a>felis venenatis</a> efficitur. Sit amet, consectetur adipiscing elit
</div>
</div>
<div class="container">
<div class="level main">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
</div>
</div>
I created a CSS rule like:
.top-of-the-world{
position: absolute !important;
z-index: 100 !important;
}
That way I do not alter Bulma's rules.
Then I added the class top-of-the-world to my notification
.notification.top-of-the-world
I have the following tiling setup. How do I go about filling the rest of the space that is available under the first tile with text Some Text to match the height of the two narrower tiles that follow? I'd like to expand the content area below the image to the height of the two tiles that follow to the right, have them all even.
<div class="tile is-ancestor">
<div class="tile is-parent is-6">
<div class="tile is-child ">
<figure>
<img src="https://bulma.io/images/placeholders/640x320.png">
</figure>
<div class="box">
<h1 class="title">One</h1>
<h6 class="subtitle is-7">Some Text</h6>
<nav class="level">
<div class="level-left">
<div class="level-item">
<font-awesome-icon :icon="iconUser" transform="shrink-3" class="icon-violet" />
dd
</div>
<div class="level-item">
Today
</div>
</div>
</nav>
</div>
</div>
</div>
<div class="tile is-parent">
<div class="tile is-child ">
<figure>
<img src="https://bulma.io/images/placeholders/640x320.png">
</figure>
<div class="box">
<h1 class="title">One</h1>
<h6 class="subtitle is-7">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed scelerisque dictum semper. Donec ornare ullamcorper velit, sagittis venenatis neque varius mattis. Suspendisse et lectus sed neque tincidunt convallis. Curabitur feugiat diam non tortor
hendrerit, id mattis dui laoreet...</h6>
<nav class="level">
<div class="level-left">
<div class="level-item">
dd
</div>
<div class="level-item">
Today
</div>
</div>
</nav>
</div>
</div>
</div>
<div class="tile is-parent">
<div class="tile is-child ">
<figure>
<img src="https://bulma.io/images/placeholders/640x320.png">
</figure>
<div class="box">
<h1 class="title">One</h1>
<h6 class="subtitle is-7">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed scelerisque dictum semper. Donec ornare ullamcorper velit, sagittis venenatis neque varius mattis. Suspendisse et lectus sed neque tincidunt convallis. Curabitur feugiat diam non tortor
hendrerit, id mattis dui laoreet...</h6>
<nav class="level">
<div class="level-left">
<div class="level-item">
dd
</div>
<div class="level-item">
Today
</div>
</div>
</nav>
</div>
</div>
</div>
</div>
CSS
img
height: 160px
width: 100%
display: block
object-fit: cover
I'm experiencing an odd issue with the sticky positioning feature that's interfering with the scroll positioning.
My intention is fairly common: keep an advertisement in a sidebar always visible when the visitor scrolls the page.
It does work as per definition as you can see in the code below — or in the Fiddle if you prefer:
body {
margin: 6rem;
}
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.sidebar .ads {
position: sticky;
top: 1rem;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<section class="col-md-10 listing">
<div class="row">
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-deck">
<div class="card" data-mh="card">
<a href="">
<img class="card-img-top thumbnail" src="https://orig00.deviantart.net/63b7/f/2013/041/9/d/free_youtube_thumbnail_template_by_imaura-d5ugja7.png" alt="Thumbnail" />
</a>
<div class="card-block">
<h3 class="card-title d-flex align-items-center hidden-sm-down lang-en">
Title
</h3>
Et aliquip non culpa pariatur quis et consectetur dolor eu laborum in nisi voluptate ut commodo dolore dolore anim est et in eu voluptate velit nulla nisi occaecat anim ut.
</div>
</div>
</div>
</div>
</div>
</section>
<section class="col-md-2 hidden-sm-down sidebar">
<div class="ads">
Sticky content
</div>
</section>
</div>
</div>
<div class="hidden-sm-up">
<br /><br /><br /><br />
</div>
However, if the real sticky content takes a while to load, which is very common with Google AdSense and alike, and the user starts scrolling down the page (or press Page Down, End, arrows...) when the said slow content finally finishes loading the whole page scrolls to the top.
I've debugged my JS to make sure it wasn't my fault. Also, when I removed the position: sticky; declaration jumping stopped.
More important than how could I fix this, I would like to know why this is happening
I have a list article in my blog. Show three columns.
The problem is: when the title of the article has 3 line. The columns are pushed down if have 4 article.
Like this:
article 1 article 2 article 3
article 4
It should be like:
article 1 article 2 article 3
article 4
My code like:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>10 The article have 2 line, it will break four item in this </h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
</div>
</div>
Note: click run code -> full page to show.
Or see my pen: https://codepen.io/vanloc/pen/RZqVXR
Have any method to resolve this problem?
The title is defined by the user, I can't control that.
You can Try Something Like This. Using this Multiline Ellipses
CSS
.post-prev-title h3
{
display: block;
display: -webkit-box;
-webkit-line-clamp: 1;/*restricting to 1 line*/
-webkit-box-orient: vertical;
overflow: hidden;
}
You can use a clearfix div to set the row correctly if the heights are uneven!
An example of that is documented here: https://getbootstrap.com/docs/3.3/css/#grid-responsive-resets
Or if you can use a LESS/SCSS mixin, that's demonstrated here: https://getbootstrap.com/docs/3.3/css/#less-mixins-clearfix
Here is that code snippet with the clearfix in. Please let me know if this isn't the solution you were looking for. Thanks!
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>10 The article have 2 line, it will break four item in this </h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<!-- CLEARFIX DIV -->
<div class="clearfix visible-lg visible-md-block"></div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
</div>
</div>