i want to show image next to text. But its showing below it
Here is the code
<div class="container">
<div class="row">
<div class="col-md-8">
<h1>This is my first post</h1>
<div> <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
<div class="col-md-4">
<img src="/media/post/Screenshot_from_2022-07-17_23-55-13.png" class="img-thumbnail" >
</div>
<div><a href="/blog/first-post" >Read More..</a></div>
<div class="col-md-8">
<h1>this is second post</h1>
<div> <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
<div class="col-md-4">
<img src="/media/post/0a61bddab956.png" class="img-thumbnail" >
</div>
<div><a href="/blog/2nd-post" >Read More..</a></div>
</div>
</div>
This is how it look like
EDIT. I copied this from view-source and some text is cut off there. Actually i am using Django jina 2 template code
{% for post in context %}
<div class="col-md-8">
<h1>{{ post.title}}</h1>
{{ post.content |truncatewords:20 | safe}}
</div>
<div class="col-md-4">
<img src="/media/{{post.image}}" class="img-thumbnail" >
</div>
<div><a href="/blog/{{post.slug}}" >Read More..</a></div>
{% endfor %}
Here is base.html file code
<div class="container">
<div class="row">
{%block content %}
{%endblock%}
</div>
</div>
I think truncatewords:20 is causing the issue.
Replacing it with truncatewords_html:20 resolved the issue
Use d-inline class on image and text.
The problem is with your HTML Code you didn't close the div of class col-md-8
Check now the code in large screen the text and image are next to each others
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<div class="container">
<div class="row">
<div class="col-md-8">
<h1>This is my first post</h1>
<div>
<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
</div>
<div class="col-md-4">
<img src="/media/post/Screenshot_from_2022-07-17_23-55-13.png" class="img-thumbnail">
</div>
<div>Read More..</div>
<div class="col-md-8">
<h1>this is second post</h1>
<div>
<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
</div>
<div class="col-md-4">
<img src="/media/post/0a61bddab956.png" class="img-thumbnail">
</div>
<div>Read More..</div>
</div>
</div>
I think a class="row" should not hold col sum greater than 12. Reformat your code like below.
<div class="container">
<div class="row">
<div class="col-md-8">
<h1>This is my first post</h1>
<div> <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
<div class="col-md-4">
<img src="/media/post/Screenshot_from_2022-07-17_23-55-13.png" class="img-thumbnail" >
</div>
</div>
<div><a href="/blog/first-post" >Read More..</a></div>
<div class="row">
<div class="col-md-8">
<h1>this is second post</h1>
<div> <p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard …
</div>
<div class="col-md-4">
<img src="/media/post/0a61bddab956.png" class="img-thumbnail" >
</div>
</div>
<div><a href="/blog/2nd-post" >Read More..</a></div>
</div>
Related
I am using Bootstrap 4 and slick slider on my project. I need to show 3 column in card style. So i design the card and then tried slick-slider on it. Its working very well. When i tried to keep 1st card fixed and then use next 2 card for sliding. But its getting out of same row.I want all card in same row.
This is how i want:
But this is what i get when i tried:
Here is my code i use which not working:
jQuery(document).ready(function ($) {
$('.sp-carousel').slick({
dots: false,
arrows: true,
infinite: true,
speed: 300,
autoplay: true,
autoplaySpeed: 2000,
slidesToShow: 3,
slidesToScroll: 1,
prevArrow: '<button class="slide-arrow prev-arrow"></button>',
nextArrow: '<button class="slide-arrow next-arrow"></button>'
});
});
/* Specialist card details start */
.sp-wrapper{ width:100%;padding:1%;}
.sp-carousel{ width:90%;height:90%; margin:0px auto;}
.cardmain{ margin:10px;}
.cardmain hr {width:100%;background-color:#ADADAD;opcaity:0.1;margin:2px;}
.slick-slide img{ width:369px;height:385px;}
.slick-prev, .slick-next{background: #000;border-radius: 15px;border-color: transparent;}
.card{border: 2px solid #fff;box-shadow: 1px 1px 15px #ccc;}
.card-header {padding:0;}
.card-header img {width:100%;}
.card-body{background:#fff;width:100%;vertical-align:top;padding:10px;}
.card-content-sp{background:#fff;}
.card-content-sp h5 {color:#000000;font-weight:400;font-size:18px;line-height:1.3em;margin-top:-1px;margin-bottom:5px;padding:0;}
.card-title{color:#000000;font-weight:500;font-size:18px;line-height:1.3em;margin-top:0;margin-bottom:0px;padding:0px;}
.card-text{color:#747373;font-size:14px;font-weight:400;font-size:1em;line-height:1.5;margin:0px;margin-bottom:10px;padding:0;font-family:Roboto-Thin;height:145px;overflow:auto;}
/* Specialist card details End */
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel#1.8.1/slick/slick.css" />
<!-- jQuery first then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/slick-carousel#1.8.1/slick/slick.min.js"></script>
<div class="sp-wrapper">
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-samim">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">DR SARKAR MAHBUB AHMED SAMIM</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
<div class="sp-carousel">
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-2">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">DR SARKAR MAHBUB AHMED SAMIM</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-3">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">DR SARKAR MAHBUB AHMED SAMIM</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-4">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">This is the Fourth slider</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-5">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">This is the Fifth slider</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
<div class="cardmain">
<div class="card">
<div class="card-header">
<img src="http://via.placeholder.com/369x385?text=dr-6">
</div><a href="dr.html">
<div class="card-body">
<div class="card-content-sp">
<div class="card-title">This is the Sixth slider</div><hr><h5>Consultant & Co-Ordinator</h5>
<div class="card-text">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to.</p>
</div>
</div>
</div></a>
</div>
</div>
</div>
</div>
Here is the code which working well but i dont want exactly:
https://jsfiddle.net/mczkqv75/2/
How can i fixed the first slider or first card then make slider from 2nd card?
Try this:
.sp-wrapper {
display: flex;
}
.sp-carousel {
flex: 0 0 66.67%;
min-width: 66.67%;
max-width: 66.67%;
}
And change slidesToShow in your JS into 2:
slidesToShow: 2,
I am generating Bootstrap columns with a PHP for loop(from a repeater field in ACF for Wordpress). I need to find a way to center a row of columns when the columns within the row don't add up to 12. I saw some other questions regarding this issue, but most involved manually adding a different class to the uneven row. Hoping to avoid that solution since I am generating these columns with a for loop.
Here's an example of the outputted HTML:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
</div>
</div>
So in this example, I would want the 3 last col-sm-3 elements to be centered below the 4 above them.
I recommend you to use Bootstrap 4. In this case, you can simply add the justify-content-center class to your row.
Heres the working snippet. (probably you won't see, cz you are using sm)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
<div class="col-sm-3">
Lorem
</div>
</div>
</div>
I have a bit trouble with using row.
I have this:
<div class="row">
<div class="large-2 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="large-8 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="large-2 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
</div>
But I get every Lorem ipsum under each other, not beside. How can I resolve this?
I suspect you might have been using mark-up suitable for either the legacy 'float' or 'flex' grid system whilst Foundation 6's default enabled is 'XY grid'. Thus, the mark-up is different and would cause your columns to stack.
Float/flex grid mark-up
<div class="row">
<div class="large-2 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="large-8 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="large-2 medium-12 small-12 columns">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
</div>
You can continue to to use 'float' or 'flex' grids but need to specify which you're using in the project. Or, if you want to use the newer 'XY grid', you can modify your mark-up like so.
XY grid mark-up
<div class="grid-x grid-margin-x">
<div class="cell large-2 medium-12 small-12">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="cell large-8 medium-12 small-12">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
<div class="cell large-2 medium-12 small-12">
<div class="callout">
<p>
Lorem Ipsum
</p>
</div>
</div>
</div>
i want to change the orientation of the col in small screen so i took the help of bootstrap Responsive utilities
<div class="row">
<div class="col-md-4 hidden-sm hidden-xs">
<h3>News title will go here with short description</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
Read more <span class="read-more-btn-symbol">»</span>
</div>
<div class="col-md-8 hidden-sm hidden-xs ">
<img class="img-responsive" src="images/mid2.jpg">
</div>
<div class="col-md-8 visible-sm visible-xs">
<img class="img-responsive" src="images/mid2.jpg">
</div>
<div class="col-md-4 visible-sm visible-xs ">
<h3>News title will go here with short description</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
Read more <span class="read-more-btn-symbol">»</span>
</div>
</div><hr>
but i dont want to write the same line twice and add different responsive classes ?
how do i fix this without writing the same thing twice
<div class="row">
<div class="col-md-4">a</div>
<div class="col-md-8">b</div>
<div class="col-md-8">b</div>
<div class="col-md-4">a</div>
</div><hr>
I try it with the last version of bootstrap and it works.
But I prefer work in separate divs with class="row".
You can add classes in the same line like this--
<div class="col-md-4 col-lg-4 col-sm-4 col-xs-4 hidden-sm hidden-xs"></div>
Then wrap all the div's inside it
Hope this helps!
I would like to make my left sidebar stay in place when I scroll up and down. I only like the content scroll. The content is the one with the h4 Task 1 Content and is displayed on the right side.
<div class="container page">
<div ng-include="'app/components/navbar/navbar.html'"></div>
<div class="row page">
<div class="small-12 large-4 columns sidebar">
<div class="row">
<a class="medium-6 columns menu-item button">
<div class="text-center">
<i class="show-for-large-up fi-page-add></i>
<p>Task 1</p>
</div>
</a>
<a class="medium-6 columns menu-item button">
<div class="text-center">
<i class="show-for-large-up fi-page-edit"></i>
<p>Task 2</p>
</div>
</a>
</div>
</div>
<div class="small-12 large-8 columns content">
<h4>Task 1 Content</h4>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
<div class="form-group large-6">
<p><input type="text" ng-model="someModel" class="form-control" placeholder="Enter string"></p>
</div>
</div>
</div>
</div>