duplicating column inside a single column - css

I knew if you want your items to be in a column in bootstrap-5 it should be like this:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col">
Column 1
</div>
<div class="col">
Column 2
</div>
<div class="col">
Column 3
</div>
</div>
</div>
But, I want to add another column inside column, because I want the contents to be in a column not in a row like this:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col">
<div class="card" style="width: 300px;">
<img src="https://c8.alamy.com/zooms/9/ad212f62fc084f68bfeed59541c0aed5/2brexeg.jpg" alt="" class="card-img-top">
<div class="card-body text-center">
<h5 class="card-title">
{{ second.first_name }} {{ second.last_name }}
</h5>
<a class="btn btn-danger" href="{% url 'Delete-secondary' second.slug %}">Delete</a>
<a class="btn btn-primary" href="{% url 'Edit-Secondary-Student' second.slug %}">Edit</a>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card">
<div class="card-body">
<div class="card-content">
<div class="card-header shadow-sm bg-body text-center">
<h4>Student Informations</h4>
</div>
<br>
<div class="col">
<ul>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
<li>First Name: Abdullahi</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
In this case, I don't like the student Information card that has ul and li to be in a row, I want them to be in a Column like this, but inside a col:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col">
<ul>
<li>First Name: Abdullahi</li>
</ul>
</div>
<div class="col">
<ul>
<li>First Name: Abdullahi</li>
</ul>
</div>
<div class="col">
<ul>
<li>First Name: Abdullahi</li>
</ul>
</div>
</div>
</div>
How can I do this?

<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
<div class="container">
<div class="row justify-content-center">
<div class="col">
<ul>
<div class="row justify-content-center">
<div class="col">
<li>First Name: Abdullahi</li>
</div>
<div class="col">
<li>First Name: Abdullahi</li>
</div>
<div class="col">
<li>First Name: Abdullahi</li>
</div>
</div>
</ul>
</div>
</div>
</div>

Related

Align title with image and add margin between the image and content is not working

I want to achieve a layout like this:
But its not working properly, Im getting this: http://jsfiddle.net/9cfqjmkb/. The title should be aligned with the top of the image but its not working. Do you know why?
Also I want some margin between the image and the other div with the title and post date, as it is in the image above, but the margin is not working. Do you know why?
HTML
<div class="container">
<div class="row">
<div class="col-3">
<div class="bg-custom-light2 p-0">
<h2 class="font-weight-bold text-custom-blue-dark h5 border-color p-2">Title</h2>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="font-weight-bold text-custom-blue-dark">Test title example for
example test post</h6>
<p>post date date</p>
</div>
<img class="ml-2" src="https://via.placeholder.com/50" alt="">
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="font-weight-bold text-custom-blue-dark">Test title example for
example test post</h6>
<p>post date date</p>
</div>
<img class="ml-2" src="https://via.placeholder.com/50" alt="">
</li>
</ul>
</div>
</div>
</div>
</div>
?
.list-group {
width:300px;
}
.ml-2 {
align-self:flex-start;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-3">
<div class="bg-custom-light2 p-0">
<h2 class="font-weight-bold text-custom-blue-dark h5 border-color p-2">Title</h2>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="font-weight-bold text-custom-blue-dark">Test title example for
example test post</h6>
<p>post date date</p>
</div>
<img class="ml-2" src="https://via.placeholder.com/50" alt="">
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="font-weight-bold text-custom-blue-dark">Test title example for
example test post</h6>
<p>post date date</p>
</div>
<img class="ml-2" src="https://via.placeholder.com/50" alt="">
</li>
</ul>
</div>
</div>
</div>
</div>

Bootstrap nav-justified inside div.col-* not working as expected

I am facing a problem with bootstrap 3 and the nav-justified class. When I put the nav inside a div with class col-*, it does not work properly. When you try to minimize the screen, if the resolution is less than 1500px the <li> overflows the div. I was wondering why.
I would like to know if I am missing something. Here goes an exemple of code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-heading clickable">
XYZ
<span class="pull-right"><i class="fa fa-caret-up fa-lg"></i></span>
</div>
<div class="panel-body ">
<ul class="nav nav-pills nav-justified" role="tablist" id="myPill">
<li role="presentation" class="active">External I/O</li>
<li role="presentation">Version Information</li>
<li role="presentation">Config Information</li>
<li role="presentation">Channel A</li>
<li role="presentation">Statistics</li>
<li role="presentation">ADC</li>
<li role="presentation">Sampling Info</li>
<li role="presentation">Flags</li>
</ul>
<hr />
<div class="tab-content" id="advancedContent">
<div class="tab-pane active" id="externalio">
</div>
<div role="tabpanel" class="tab-pane" id="versionInformation">
</div>
<div role="tabpanel" class="tab-pane" id="configInformation">
</div>
<div role="tabpanel" class="tab-pane" id="channelA">
</div>
<div role="tabpanel" class="tab-pane" id="statistics">
</div>
<div role="tabpanel" class="tab-pane" id="adc">
</div>
<div role="tabpanel" class="tab-pane" id="samplingInfo">
</div>
<div role="tabpanel" class="tab-pane" id="flags">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Thank you.
I have a easy solution. Use this code below:
#media screen and (max-width:1500px){
.panel .nav>li>a{
padding:5px 0;
}
}

Bootstrap ordering panels

I've a bootstrap website but when i want that the panels are close together like on my screenshot.
As you can see the blue panel is far away from the panel above.
I want that the panel is like the green one but... i don't get it.
Tried to use all the cols in one row but it does not work.
Here is my source code:
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">CSS Frameworks</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Bootstrap</li>
<li>Foundation</li>
<li>Skeleton</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Hulp bij programmeren</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Stackoverflow</li>
<li>W3Schools</li>
<li>PHPTuts.nl</li>
<li>Codeschool</li>
<li>Lynda</li>
<li>Treehouse</li>
<li>CSS-Tricks</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Generators</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Border radius generator</li>
<li>CSS Animation generator</li>
<li>CSS Box shadow generator</li>
<li>CSS button generator</li>
<li>CSS filter generator</li>
<li>CSS text shadow generator</li>
<li>CSS shapes generator</li>
<li>Google maps generator</li>
<li>Hash generator</li>
<li>HTML5 responsive form generator</li>
<li>Meta tag generator</li>
<li>Pricing table generator</li>
<li>QR Code generator</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Webdesign</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Flat UI Colors</li>
<li>Color shades generator</li>
<li>Freeimages</li>
<li>Dribbble</li>
<li>Behance</li>
<li>Line25</li>
<li>CSS-Tricks</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Bootstrap</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Download bootstrap</li>
<li>Customize and download</li>
<li>CSS</li>
<li>Components</li>
<li>JavaScript</li>
<li>Bootstrap W3schools</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Bootstrap</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Download bootstrap</li>
<li>Customize and download</li>
<li>CSS</li>
<li>Components</li>
<li>JavaScript</li>
<li>Bootstrap W3schools</li>
</ul>
</div>
</div>
</div>
</div>
Just put the last panel block into the first .col-md-3.col-sm-4:
<div class="col-md-3 col-sm-4">
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">CSS Frameworks</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>
Bootstrap
</li>
<!-- ... -->
</ul>
</div>
</div>
<div class="panel panel-main">
<div class="panel-heading">
<h3 class="panel-title">Bootstrap</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>
Download bootstrap
</li>
<!-- ... -->
</ul>
</div>
</div>
</div>
Demo: http://plnkr.co/edit/VIzi52ziUDbm9vHuIfsk?p=preview

Why my div not going to the right?

Why span5 not going to the right position? Span5 is go to under Span6.I'm linked to bootstrap
My code:
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="container">
<div class="row">
<div class="span6">
<a href="#">
<img src="image/logo.png" class="logo_img" />
</a>
</div>
<div class="span5">
<ul class="nav nav-pills nav-pos">
<li>Ваш город
</li>
<li>Клиники
</li>
<li>Врачи
</li>
<li>Диагностика
</li>
</ul>
</div>
</div>
</div>
</header>
Use display: inline-block.
.span6, .span5 {
display: inline-block;
vertical-align: top;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="container">
<div class="row">
<div class="span6">
<a href="#">
<img src="http://dummyimage.com/40/" class="logo_img" />
</a>
</div>
<div class="span5">
<ul class="nav nav-pills nav-pos">
<li>Ваш город
</li>
<li>Клиники
</li>
<li>Врачи
</li>
<li>Диагностика
</li>
</ul>
</div>
</div>
</div>
</header>
From your snippet, it's hard to advise you're best option. Although one 'simple' styling would be to add float:right to your css like so:
.span5{
float:right;
}
The Demo below shows this in action:
.span5{
float:right;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="container">
<div class="row">
<div class="span6">
<a href="#">
<img src="image/logo.png" class="logo_img" />
</a>
</div>
<div class="span5">
<ul class="nav nav-pills nav-pos">
<li>Ваш город
</li>
<li>Клиники
</li>
<li>Врачи
</li>
<li>Диагностика
</li>
</ul>
</div>
</div>
</div>
</header>
you could also use the display options, like below (aligning logo next to links):
div{
display:inline-block;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="container">
<div class="row">
<div class="span6">
<a href="#">
<img src="image/logo.png" class="logo_img" />
</a>
</div>
<div class="span5">
<ul class="nav nav-pills nav-pos">
<li>Ваш город
</li>
<li>Клиники
</li>
<li>Врачи
</li>
<li>Диагностика
</li>
</ul>
</div>
</div>
</div>
</header>

Center align five columns in a single row without offset - bootstrap

I have five col-md-2 div inside a row div.
To center align i have used col-md-offset-1 with the first col-md-2 div.
I made the column divs Sortable(jqueryui)
http://jqueryui.com/sortable/#display-grid
So now when i move the first col-md-2 div, the offset moves with it.
http://jsfiddle.net/1uuuru2m/4/
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function() {
$("#sortable").sortable();
$("#sortable").disableSelection();
});
</script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="row content-boxes" id="sortable">
<div class="col-md-2 col-md-offset-1 ui-state-default">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">A</h3>
</div>
<div class="list-group">
<li class="list-group-item">first child of a</li>
<li class="list-group-item">second child of a</li>
<li class="list-group-item">third child of a</li>
</div>
</div>
</div>
<div class="col-md-2 ui-state-default">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">B</h3>
</div>
<div class="list-group">
<li class="list-group-item">first child of b</li>
<li class="list-group-item">second child of b</li>
<li class="list-group-item">third child of b</li>
</div>
</div>
</div>
<div class="col-md-2 ui-state-default">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">C</h3>
</div>
<div class="list-group">
<li class="list-group-item">first child of c</li>
<li class="list-group-item">second child of c</li>
<li class="list-group-item">third child of c</li>
</div>
</div>
</div>
<div class="col-md-2 ui-state-default">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">D</h3>
</div>
<div class="list-group">
<li class="list-group-item">first child of d</li>
<li class="list-group-item">second child of d</li>
<li class="list-group-item">third child of d</li>
</div>
</div>
</div>
<div class="col-md-2 ui-state-default">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">E</h3>
</div>
<div class="list-group">
<li class="list-group-item">first child of e</li>
<li class="list-group-item">second child of e</li>
<li class="list-group-item">third child of e</li>
</div>
</div>
</div>
</div>
</body>
</html>
How can I maintain the center-alignment inside the row div without using offset on first col div?
Use an empty col-md-1 instead of offset so that it doesn't move around. JSFiddle.
<div class="row content-boxes" id="sortable">
<div class="col-md-2 col-md-offset-1 ui-state-default">
goes to
<div class="row content-boxes" id="sortable">
<div class="col-md-1"></div>
<div class="col-md-2 ui-state-default">

Resources