Bootstrap Tabs Float Image Right - html

I've got a basic nav-tabs in Twitter Bootstrap and I've got an image after all of my tabs, that I'd like to float right. I've tried modifying its float, text-align, and other attributes, and even the pull-right class as mentioned on a separate but related SO question.
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="stuff-tab" data-toggle="tab" href="#stuff" role="tab" aria-controls="stuff" aria-selected="true">Stuff</a>
</li>
<!-- ... -->
<img class="pull-right text-right float-right" src="myimg.png" width="32px" height="32px">
What Bootstrap class or CSS should I write to make my image float to the right?
(Bootstrap 4 if that matters)

<nav class="navbar header navbar-light bg-dark" id="myHeader">
<div class="container">
<p class="">logo</p>
// from here you get all elements on right side
<ul class="list-inline">
<li class="list-inline-item">
<div class="frqst">
<button class="fas fa-users btn text-white"></button>
<div>
<ul class="list-group">
<li class="border-bottom">
<p>first right item
</p>
</li>
</ul>
</div>
</div>
</li>
<li class="list-inline-item">
<button class="fas fa-comment btn text-white">second right item</button>
</li>
<li class="list-inline-item">
<p>third right item</p>
</li>
<li class="list-inline-item">
<img src="../../myimg.jpg">
</li>
<li class="list-inline-item">
<a class="text-white" href="./models/logout.html">Logout</a>
</li>
</ul>
</div>
</nav>

Put a div tag around the image and use d-flex justify-content-end like this:
<div class="row">
<div class="col-md-12">
<div class="">
<div class="">
<ul class="nav nav-pills w-100">
<li class="nav-item">
<a class="nav-link active" id="stuff-tab" data-toggle="tab" href="#stuff" role="tab"
aria-controls="stuff" aria-selected="true">Stuff</a>
</li>
</ul>
</div>
<div class="d-flex justify-content-end">
<img src="https://cdn.searchenginejournal.com/wp-content/uploads/2019/09/f46bc1a6-9ffa-4434-a77a-ea1491d3597a-760x400.jpeg"
class="">
</div>
</div>
</div>
</div>
I tested this. Should work.
Another you can try:
<div class="col-md-12" style="border-top: 2px solid #000;">
<div class="mx-4">
<div class="footer pt-3">
<div class="row">
<div class="col-md-6">
<ul>
<li class="nav-item">
<a class="nav-link active" id="stuff-tab" data-toggle="tab" href="#stuff" role="tab" aria-controls="stuff"
aria-selected="true">Stuff</a>
</li>
</ul>
</div>
<div class="col-md-6">
<div class="float-right">
<img class="pull-right text-right float-right" src="http://placekitten.com/301/301" width="32px" height="32px">
</div>
</div>
</div>
</div>
</div>
</div>

Related

How do I align the container at the top with my navigation bar in Bootstrap 5?

new to bootstrap! I am trying to align the navigation bar and the top title. The yellow area is wider than the navigation bar. I also need help setting the background image to span the whole website. If anyone can give me some suggestions, it would be appreciated!
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<!doctype html>
<div class="container bg-warning">
<div class="row">
<div class="d-flex justify-content-center">
<p class="display-1">Thuan's Website</p>
</div>
</div>
</div>
<div class="container">
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<a href="#" class="navbar-brand" />
<img src="https://img.icons8.com/ios-glyphs/30/000000/redo.png" />Thuan
</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a href="#" class="nav-link">Home
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Forums
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Games
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact
</a>
</li>
</ul>
</div>
</nav>
</div>
In order to get the title and navbar full width just put it oustside container class
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<div class="d-flex justify-content-center bg-warning">
<p class="display-1">Thuan's Website</p>
</div>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<a href="#" class="navbar-brand" />
<img src="https://img.icons8.com/ios-glyphs/30/000000/redo.png" />Thuan
</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a href="#" class="nav-link">Home
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Forums
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Games
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">Contact
</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
</div>
</div>

Bootstrap collapse not working on nested unordered list

I've been having some issues on getting elements of a nested unordered list to collapse and expand.
While the first element functions correctly but subsequent elements don't appear to work. I'm I missing a class or something similar?
Please see attached working example code demonstrating the issue i have.
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<ul class="list-group list-group-flush">
<li class="list-group-item list-group-item-action">
<a href="#f1499360-b771-487a-9d84-e399f69f4568" data-toggle="collapse" class="" aria-expanded="true">
<h3>Test Site</h3>
</a>
<div class="collapse show" id="f1499360-b771-487a-9d84-e399f69f4568" style="">
<ul class="list-group">
<li class="list-group-item">
<a href="#c6f8ebd3-5a92-461d-a37b-dcf314897361" data-toggle="collapse" class="" aria-expanded="true">
<h5>132</h5>
</a>
<div class="collapse show" id="c6f8ebd3-5a92-461d-a37b-dcf314897361" style="">
<ul class="list-group">
<li class="list-group-item">
<a href="#e867a283-4dee-44fa-884a-6b7cf7cc42fe" data-toggle="collapse" class="" aria-expanded="true">
<h5>Hello</h5>
</a>
<div class="collapse show" id="e867a283-4dee-44fa-884a-6b7cf7cc42fe" style="">
<ul class="list-group">
<li class="list-group-item">
<h6>Direct Connect Drive Status</h6>
<div class="float-left">Drive 1:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-left">Drive 2:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-left">Drive 3:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-left">Drive 4:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#50e71ff4-7ef5-4b2e-8615-cdfe328320a9" data-toggle="collapse">
<h5>name 2</h5>
</a>
<div class="collapse" id="50e71ff4-7ef5-4b2e-8615-cdfe328320a9">
<ul class="list-group">
<li class="list-group-item">
<h6>Direct Connect Drive Status</h6>
<div class="float-left">Drive 1:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-left">Drive 2:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
<div class="float-left">Drive 3:</div>
<div class="float-right">Float right on all viewport sizes</div><br>
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#4c6fc729-78b4-4d06-bbdd-749c96cafd05" data-toggle="collapse">
<h5>Test Assign</h5>
</a>
<div class="collapse" id="4c6fc729-78b4-4d06-bbdd-749c96cafd05">
<ul class="list-group">
<li class="list-group-item">
<h6>Direct Connect Drive Status</h6>
<div class="float-left text-warning">Not Configured - Check Settings</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#5b2e25aa-c480-445b-91a6-a46f61291a51" data-toggle="collapse">
<h5>aaa</h5>
</a>
<div class="collapse" id="5b2e25aa-c480-445b-91a6-a46f61291a51">
<ul class="list-group">
<li class="list-group-item">
<a href="#cd2a0ea7-1935-4546-9b2a-c9a3fa9ffb47" data-toggle="collapse">
<h5>Station module 2</h5>
</a>
<div class="collapse" id="cd2a0ea7-1935-4546-9b2a-c9a3fa9ffb47">
<ul class="list-group">
<li class="list-group-item">
<h6>Direct Connect Drive Status</h6>
<div class="float-left text-warning">Not Configured - Check Settings</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</body>
</html>
Using element id's that start with numbers won't work. Rename the id's, or prepend a non-numeric char such as _...
Demo: https://www.codeply.com/go/1xEVX8Ye2u
<ul class="list-group">
<li class="list-group-item">
<a href="#c6f8ebd3-5a92-461d-a37b-dcf314897361" data-toggle="collapse" class="" aria-expanded="true">
<h5>132</h5>
</a>
<div class="collapse show" id="c6f8ebd3-5a92-461d-a37b-dcf314897361" style="">
<ul class="list-group">
<li class="list-group-item">
<a href="#e867a283-4dee-44fa-884a-6b7cf7cc42fe" data-toggle="collapse" class="" aria-expanded="true">
<h5>Hello</h5>
</a>
<div class="collapse show" id="e867a283-4dee-44fa-884a-6b7cf7cc42fe" style="">
<ul class="list-group">
<li class="list-group-item">
...
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#_50e71ff4-7ef5-4b2e-8615-cdfe328320a9" data-toggle="collapse">
<h5>name 2</h5>
</a>
<div class="collapse" id="_50e71ff4-7ef5-4b2e-8615-cdfe328320a9">
<ul class="list-group">
<li class="list-group-item">
...
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#_4c6fc729-78b4-4d06-bbdd-749c96cafd05" data-toggle="collapse">
<h5>Test Assign</h5>
</a>
<div class="collapse" id="_4c6fc729-78b4-4d06-bbdd-749c96cafd05">
<ul class="list-group">
<li class="list-group-item">
...
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li class="list-group-item">
<a href="#5b2e25aa-c480-445b-91a6-a46f61291a51" data-toggle="collapse">
<h5>aaa</h5>
</a>
<div class="collapse" id="5b2e25aa-c480-445b-91a6-a46f61291a51">
<ul class="list-group">
<li class="list-group-item">
<a href="#cd2a0ea7-1935-4546-9b2a-c9a3fa9ffb47" data-toggle="collapse">
<h5>Station module 2</h5>
</a>
<div class="collapse" id="cd2a0ea7-1935-4546-9b2a-c9a3fa9ffb47">
<ul class="list-group">
<li class="list-group-item">
...
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>

Bootstrap align text and image

I am trying to make divs inline in the card box and doing it also. But text is being vertically centered next to. can not managed the make the text start the top.
<div class="card text-left">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="d-inline"><img src="{{$estate->image}}" id="image"></div>
<div class="d-inline">{{$estate->building_name}}</div>
</div>
</div>
Try to use d-inline for to make image and text side by side. But this time text is being vertically aligned.
You have to use d-inline-flex and align-top
<div class="card-body">
<div class="d-inline-flex"><img src="{{$estate->image}}" id="image"></div>
<div class="d-inline-flex align-top">{{$estate->building_name}}</div>
</div>

Positioning images within grid

I'm trying to get the flag icons in the header closer together (I've attached a picture of the relevant section). I've switched around CSS values, but so far no success. I'm using Bootstrap as well.
Here is the relevant code:
.flag {
height: 25px;
width: 25px;
padding: 0px;
}
<nav class="navbar navbar-expand-sm navbar-light bg-light mb-3">
<div class="container">
<a class="navbar-brand" href="#">
<img src="./images/logo/LOGO DARKGLOBE.png" height="100px" width="150px">
</a>
<ul class="navbar-nav align-items-center">
<li class="nav-item">
<a class="nav-link" href="./home.html">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle active" data-toggle=dropdown href="#">Empresa</a>
<div class="dropdown-menu">
Quem somos
Missao & Valores
Ambiente & Sustentabilidade
Higiene, Seguranc & Saude
Emprego & Igualdade de Oportunidades
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Portfolio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Projectos em Curso</a>
</li>
<li class="nav-item">
<a class="nav-link" href="./contactos.html">Contacto</a>
</li>
<li class="nav-item">
<div class="row">
<div class="col">
<a href="#">
<img class="flag" src="./images/flags/portugal-flag-button-round-icon-256.png">
</a>
</div>
<div class="col">
<a href="#">
<img class="flag" src="./images/flags/spain-flag-button-round-icon-256.png">
</a>
</div>
</div>
<div class="row">
<div class="col">
<a href="#">
<img class="flag" src="./images/flags/france-flag-button-round-icon-256.png">
</a>
</div>
<div class="col">
<a href="#">
<img class="flag" src="./images/flags/united-kingdom-flag-button-round-icon-256.png">
</a>
</div>
</div>
</li>
</ul>
</div>
</nav>
I'm guessing this is a fairly straightforward fix, but this is the first time I'm creating a website from scratch. The little I know about web design I've gleamed from reading here and there. Thanks in advance!
Header

How do I get a Bootstrap 4 nav to appear on the same line as a header?

Here you can see what it looks like right now.
What it looks like now
How do I get the nav to appear on the right side of the screen while making it be on the same line as the copyright? I cannot seem to get anything to work that I have seen on here so far.
Here is my current code:
<div class="container-fluid footer">
<div class="spacer"></div>
<div class="container">
<h5 style="display: inline">Copyright © 2017 Custom Prop Shop</h5>
<ul class="nav flex-column flex-sm-row justify-content-end pull-right">
<li class="nav-item">
<a class="nav-link" href="request-estimate.html">Request an Estimate</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-work.html">Our Work</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-clients.html">Our Clients</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-story.html">Our Story</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
<div class="spacer"></div>
</div>
CSS is only controlling color of the text/background and the font-size for this part.
I think the easiest way would be to make the container d-flex, and then use my-auto to vertically center the h5...
<div class="container d-flex justify-content-between">
<h5 class="my-auto">Copyright © 2017 Custom Prop Shop</h5>
<ul class="nav flex-column flex-sm-row">..</ul>
</div>
https://www.codeply.com/go/1WWhy3uP9C
You can use something like this
<div class="container-fluid footer">
<div class="spacer"></div>
<div class="container">
<div class="row">
<div class="col">
<h5 style="display: inline">Copyright © 2017 Custom Prop Shop</h5>
</div>
<div class="col">
<ul class="nav flex-column flex-sm-row justify-content-end pull-right">
<li class="nav-item">
<a class="nav-link" href="request-estimate.html">Request an Estimate</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-work.html">Our Work</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-clients.html">Our Clients</a>
</li>
<li class="nav-item">
<a class="nav-link" href="our-story.html">Our Story</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
</div>
<div class="spacer"></div>
</div>
You can reference Bootstrap Grid Options over here https://v4-alpha.getbootstrap.com/layout/grid/#grid-options
add float: left on the h5.
or float: right on the ul