I have 2 buttons and a form with input type inside of it. I want all of them be inline , but I can't do that.
This is what I have:
.btn-registerLayout {
background-color: #425fab;
font-size: 10px;
outline: none;
text-align: left;
cursor: pointer;
height: 22px !important;
width: 50px !important;
padding: 0 !important;
margin: 0 !important;
}
.btn {
color: #fff !important;
}
/* Search Section*/
.header-search .header-search-box {
position: relative;
width: 100%;
}
.header-search-input {
width: 100%;
background: #f0f0f0;
font-size: 12px;
height: 20px;
transition: .2s;
color: darkgreen;
outline: none;
display: inline;
border: 1px solid red !important;
position: relative;
overflow: hidden;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="d-inline pl-5" style="float:left">
<div class="d-inline">
<form asp-action="Index" asp-controller="Products" class="form-inline" method="get">
<input type="search" class="header-search-input" name="SearchKey" placeholder="Search">
</form>
</div>
<button class="btn btn-registerLayout d-inline" style="width:28px !important">
<i class="ml-2 bi bi-person-plus-fill"></i>
</button>
<button class="btn btn-registerLayout d-inline">
<i class="ml-2 bi bi-box-arrow-in-right"></i><span style="padding-left:5px"> Login</span>
</button>
</div>
but I can not make form inline with buttons and result is like this:
Add d-inline-flex on the parent to get the elements inline, then you can use spacers or ml to space out the buttons from the input.
.btn-registerLayout {
background-color: #425fab;
font-size: 10px;
outline: none;
text-align: left;
cursor: pointer;
height: 22px !important;
width: 50px !important;
padding: 0 !important;
margin: 0 !important;
}
.btn {
color: #fff !important;
}
/* Search Section*/
.header-search .header-search-box {
position: relative;
width: 100%;
}
.header-search-input {
width: 100%;
background: #f0f0f0;
font-size: 12px;
height: 20px;
transition: .2s;
color: darkgreen;
outline: none;
display: inline;
border: 1px solid red !important;
position: relative;
overflow: hidden;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="d-inline-flex pl-5">
<div class="d-inline-block mx-auto">
<form asp-action="Index" asp-controller="Products" class="form-inline" method="get">
<input type="search" class="header-search-input" name="SearchKey" placeholder="Search">
</form>
</div>
<button class="btn btn-registerLayout d-inline ml-2" style="width:28px !important">
<i class="bi bi-person-plus-fill"></i>
</button>
<button class="btn btn-registerLayout d-inline ml-2">
<i class="bi bi-box-arrow-in-right"></i><span> Login</span>
</button>
</div>
.btn-registerLayout {
background-color: #425fab;
font-size: 10px;
cursor: pointer;
}
.btn {
color: #fff !important;
}
/* Search Section*/
.header-search .header-search-box {
position: relative;
width: 100%;
}
.header-search-input {
width: 100%;
background: #f0f0f0;
font-size: 12px;
height: 20px;
transition: .2s;
color: darkgreen;
outline: none;
display: inline;
border: 1px solid red !important;
position: relative;
overflow: hidden;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons#1.8.1/font/bootstrap-icons.css">
<div class="d-inline pl-5" style="float:left">
<div class="d-inline">
<form asp-action="Index" asp-controller="Products" class="form-inline" method="get">
<input type="search" class="header-search-input" name="SearchKey" placeholder="Search">
</form>
</div>
<div class="btn-wrap"><button class="btn btn-registerLayout d-inline">
<span>Login<i class="ml-2 bi bi-box-arrow-in-right"></i></span>
</button>
<button class="btn btn-registerLayout d-inline">
<i class="ml-1 bi bi-person-plus-fill"></i>
</button>
</div>
</div>
</div>
Always works a bit better grouping buttons like that in a wrapper of some sort.
Related
I am checking my website different resolutions and browsers using Dev Tools and www.responsinator. in the web site I have used the owl Carousel, but in iPhone XR (414896) or iphone 12 pro (390844) or samsung galaxy (412 * 912) it is messed up.
in real it is like this
but on those resolution it is like this
this is the code for this part:
.cart-col {
width: 100%;
padding: 10px;
border: 1px solid #e2efef;
box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.29);
position: relative;
display: inline-block;
background: #fff;
border-radius: 10px;
margin-bottom: 15px;
}
.cart-title {
font-size: 13px;
font-family: IRANSans;
font-weight: bold;
padding-right: 7px;
display: inline-block;
}
.btn-filter {
background-color: #ffffff;
font-size: 14px;
outline: none;
cursor: pointer;
border: 1px solid #ccc;
vertical-align: middle;
width: 100px !important;
float: right;
margin-right: 15px;
margin-top: 15px;
}
.btn-filter>a {
color: #ccc;
display: flex;
align-items: center;
justify-content: center;
margin: 10px;
}
.btn-filter>a:hover {
color: black;
}
.img-filter {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
.filter-title {
font-size: 12px;
font-family: IRANSans;
padding-right: 7px;
display: inline-block;
margin-top: 20px;
}
.filter-option {
font-size: 12px;
font-family: IRANSans;
padding-right: 7px;
}
<!-- ----- Bootstrap-4 ----- -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- ----- Body ------------ -->
<div class="col-lg-2 col-md-2 col-sm-12 mr-1 ml-2 cart-col fixed" style="height:650px;">
<div class="cart-title">Filter </div>
<div>
<hr /> </div>
<div class="filter-title">Select the options </div>
<div>
<div class="btn-filter">
<a asp-controller="" asp-action="">0-2 </a>
</div>
<div class="btn-filter">
<a asp-controller="" asp-action="">3-5 </a>
</div>
</div>
<div>
<div class="btn-filter">
<a asp-controller="" asp-action="">6-8</a>
</div>
<div class="btn-filter">
<a asp-controller="" asp-action="">8-12 </a>
</div>
</div>
<div>
<div class="filter-title">Select the type </div>
<div>
<select class="form-control filter-option" id="BookType" asp-items="#ViewBag.BookType">
<option value="">vocal </option>
</select>
</div>
</div>
<div>
<div class="filter-title">select the subject </div>
<div>
<select class="form-control filter-option" id="BookSubject" asp-items="#ViewBag.BookSubject">
<option value="">comic</option>
</select>
</div>
</div>
<div class="img-filter"><img src="~/images/filter.jpg" /> </div>
how can I make adjustable for this resolution
Update
=============================
I checked my code and I found that I have search input in my layout
<form asp-action="Index" asp-controller="Products" method="get" class="form-inlineflex">
<input type="search" class="header-search-input d-inline-flex" name="SearchKey">
<div class="action-btns d-inline-flex ">
<button class="btn btn-search" type="submit">
<i class="bi bi-search "></i>
</button>
</div>
</form>
with CSS:
.header-search-input {
background: #f0f0f0;
font-size: 12px;
height: 24px;
padding: 0;
outline: none;
}
if I remove this class from input box, so everything will be ok in any resolution and browser, but things will be messy in a few resolution as soon as I set that class to the inputbox
can anyone give me a clue for the reason?
Info is in the title and code is here: https://jsfiddle.net/cduyqxs1/
The popover box and tooltip should show up next to the buttons.
Anyone telling me I'm an idiot for not knowing, saying I shouldn't use Bootstrap or any other negative comments will be ignored as that seems to be the culture on here.
Thanks in advance.
HTML:
<!doctype html>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Overpass:wght#700&display=swap" rel="stylesheet">
<title>Bootstrap</title>
<!-- {05} - Modals, Popovers & Tooltips -->
<div class="lesson-container">
<h2 id="mpt-header" class="lesson-header">Modals, Popovers & Tooltips</h2>
<div class="lesson-box" id="mpt-box">
<h4><span class="gold-text">Eg.1: </span>These are email <span class="blue-text">Modals</span>.</h4>
<div class="mpt-examples">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Email Tarek
</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Email Kirsten
</button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Email Tommy
</button>
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</div>
<h4><span class="gold-text">Eg.2: </span>This is a <span class="blue-text">Popover</span>.</h4>
<div id="popover-example" class="mpt-examples">
<button id="myPopover" type="button" class="btn btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?" data-placement="bottom">Click to toggle popover</button>
</div>
<h4><span class="gold-text">Eg.3: </span>This a <span class="blue-text">Tooltip</span>.</h4>
<div id="tooltip-example" class="mpt-examples tooltip-example">
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom" id="myTooltip">Tooltip on bottom</button>
</div>
</div>
<div class="break-line"></div>
<div class="lesson-notes">
<ul>
<li><p>Modals are positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead.</p></li>
<li><p>Popovers are a common interface element shows a textbox displaying information when a user clicks on it. The same is with Tooltips, but you get information from Tooltips by hovering over them.</p></li>
</ul>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.1.1/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript" src="bootstrap.js"></script>
CSS:
body
{
padding: 0;
margin: 0;
position: relative;
}
#page-shell
{
margin-top: 70px;
}
#no-border-1, #no-border-2, #no-border-3, #no-border-4, #no-border-5
{
border: none !important;
}
.blue-text
{
color: blue;
}
.gold-text
{
color: goldenrod;
font-weight: bold;
}
.bold-text
{
font-weight: bold;
}
.break-line
{
width: 50%;
height: 3px;
background-color: gray;
border-radius: 50%;
opacity: 15%;
margin: 35px 0px;
position: relative;
left: 50%;
transform: translateX(-50%);
}
#past-lessons
{
border-bottom: 2px solid black;
padding-bottom: 10px;
}
#past-lessons a
{
font-size: 73%;
margin-right: 5px;
border-right: 1px solid gray;
padding-right: 7px;
}
#past-lessons a:hover
{
text-decoration: none;
}
#past-lessons a:active
{
color:aqua;
}
#section-links
{
list-style-type: none;
text-decoration: none;
position: relative;
left: -15px;
top: -15px;
}
#section-links a
{
color: ghostwhite;
font-size: 80%;
}
#section-links a:hover
{
color: black;
text-decoration: none;
}
#section-links a:active
{
color: blueviolet;
}
.navbar
{
display: flex;
justify-content: flex-end;
}
.lesson-container
{
margin: 15px 0px 15px 30px;
border-bottom: 2px solid gray;
padding: 15px 0px;
}
.lesson-header
{
text-decoration: underline;
margin-bottom: 25px;
}
.lesson-box
{
background-color:cornsilk;
width: 50%;
padding: 15px;
border: 1px solid black;
}
.lesson-notes
{
margin-left: -20px;
}
#no-bot-border
{
border-bottom: none;
}
.grid-box
{
height: 100px;
background-color: lightgray;
margin: 0 auto;
border-radius: 8px;
}
.grid-text
{
text-align: center;
margin: 30px auto;
font-family: 'Overpass', sans-serif;
font-size: 35px;
box-shadow: 20;
}
#media (max-width: 1050px)
{
.grid-box
{
margin: 15px;
}
.grid-text
{
margin: 35px auto;
font-size: 25px;
}
}
#navbars-box
{
height: 215px;
}
#media (max-width: 990px)
{
#navbars-box
{
height: 415px;
}
}
.form-examples
{
margin-bottom: 25px;
border: 1px solid gray;
padding: 10px;
background-color: white;
overflow: scroll;
}
.components-examples
{
margin-bottom: 35px;
border: 1px solid gray;
padding: 10px;
}
.jumbotron
{
background-image: url(imgs/water-large.jpg);
background-size: cover;
background-position: center;
}
.progress
{
width: 100%;
}
#cards-box
{
margin: 0 auto;
}
.btn-space, .card-text, .card-title
{
margin: 5px;
}
.single-card
{
min-width: 186px;
}
#media (max-width: 1665px)
{
.single-card
{
margin-top: 15px;
}
}
.mpt-examples
{
margin-top: 15px;
margin-bottom: 25px;
}
#popover-example
{
height: 100px;
}
JS:
$('[data-toggle="popover"]').popover();
$('[data-toggle="tooltip"]').tooltip();
I want to add a search icon on the left side of the input text and a speaker icon on the right side.
Something like this
Currently my I have :
Here is my code :
.search-bar {
width: 20%;
position: relative;
}
.search-bar input {
width: 100%;
height: 30px;
text-align: center;
border: none;
border-radius: 18px;
outline: none;
}
.search-ico {
position: absolute;
left: 10px;
}
<!--Search Bar-->
<div class="search-bar">
<input type="text" name="search" placeholder="Search" />
<i class="fa-solid fa-magnifying-glass search-ico"></i>
</div>
How can I achieve this? Thanks.
In addition to the answer above you can add pointer for the icon for simulate mouse with cursor:pointer; like:
body {
background: #333;
marging: 0;
}
.search-bar {
width: 30%;
position: relative;
}
.search-bar input {
width: calc(100% - 60px);
height: 30px;
text-align: center;
border: none;
border-radius: 18px;
outline: none;
padding: 0 30px;
}
.search-ico {
position: absolute;
left: 10px;
top:8px;
cursor: pointer; // add cursor
}
.microphone-ico {
position: absolute;
right: 10px;
top: 8px;
cursor: pointer; // add cursor
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!--Search Bar-->
<div class="search-bar">
<input type="text" name="search" placeholder="Search" />
<i class="fa fa-search search-ico"></i>
<i class="fa fa-microphone microphone-ico"></i>
</div>
If you use bootstrap 4 you can use input group like:
.input-group-text i{
cursor:pointer;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<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="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search search-ico"></i></span>
</div>
<input type="text" class="form-control" aria-label="Search here">
<div class="input-group-append">
<span class="input-group-text"><i class="fa fa-microphone microphone-ico"></i></span>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
You are going the right way, using position: absolute set the icons
body {
background: #333;
marging: 0;
}
.search-bar {
width: 30%;
position: relative;
}
.search-bar input {
width: calc(100% - 60px);
height: 30px;
text-align: center;
border: none;
border-radius: 18px;
outline: none;
padding: 0 30px;
}
.search-ico {
position: absolute;
left: 10px;
top:8px;
}
.microphone-ico {
position: absolute;
right: 10px;
top: 8px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!--Search Bar-->
<div class="search-bar">
<input type="text" name="search" placeholder="Search" />
<i class="fa fa-search search-ico"></i>
<i class="fa fa-microphone microphone-ico"></i>
</div>
I want to stretch my search input field like the original pic. Can anyone show me how I can stretch it to make it the same as the original? I'm using bootstrap and react.js. I have uploaded the original pic and my result pic for reference as well as HTML and CSS code. I have tried many ways but still fail.
Original
My Result
HTML & CSS
.logo {
width: 50px;
margin-right: 20px;
}
.logo img {
width: 100%;
}
.location {}
.location input {
background-color: #fff;
border: 2px #002f34 solid;
border-radius: 5px;
}
.location .ico {
padding: 10px;
height: 100% !important;
background-color: #000 !important;
color: #fff;
border: none;
outline: inherit;
}
.search {}
.search input {
width: 100px;
background-color: #fff;
border: 2px #002f34 solid;
border-radius: 5px;
}
.search .ico {
padding: 10px;
height: 100% !important;
background-color: #000 !important;
color: #fff;
border: none;
outline: inherit;
}
.sell {
padding: 8px 20px;
border: 3px #ffa500 solid;
color: #002f34;
text-align: center;
background: #fff;
border-radius: 30px;
box-shadow: 0px 3px 5px #a9a9a9;
}
.login {
padding-right:10px;
text-decoration: underline;
font-size: 18px;
font-weight: bold;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand logo" href="#">
<img src={require("../ui/logo.png")} />
</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<div class="input-group input-group-lg location mr-4">
<input type="text" class="form-control" placeholder="Pakistan" />
<div class="input-group-btn">
<button class="fas fa-search ico"></button>
</div>
</div>
<div class="input-group input-group-lg search">
<input type="text" class="form-control" placeholder="Find Mobile, Car ,laptop" />
<div class="input-group-btn">
<button class="fas fa-search ico"></button>
</div>
</div>
</ul>
<form class="form-inline my-2 my-lg-0">
<h6 class="mr-sm-2 login" >Login</h6>
<button class="my-2 my-sm-0 fas fa-plus sell"> SELL</button>
</form>
</div>
</nav>
First thing was to replace your divinto your ul for li.
Then I created the 2 class below:
.flex-1{
flex: 1;
}
.flex-2{
flex: 2;
}
To adjust the flex size of the element.
I set flex-2 on ul & second li.
And flex-1 on 1st li.
TO Make demo work, I change className by class. So you may need to change them back to make them work.
DEMO (check it full page)
.logo {
width: 50px;
margin-right: 20px;
}
.logo img {
width: 100%;
}
.location {}
.location input {
background-color: #fff;
border: 2px #002f34 solid;
border-radius: 5px;
}
.location .ico {
padding: 10px;
height: 100% !important;
background-color: #000 !important;
color: #fff;
border: none;
outline: inherit;
}
.search {}
.search input {
width: 100px;
background-color: #fff;
border: 2px #002f34 solid;
border-radius: 5px;
}
.search .ico {
padding: 10px;
height: 100% !important;
background-color: #000 !important;
color: #fff;
border: none;
outline: inherit;
}
.sell {
padding: 8px 20px;
border: 3px #ffa500 solid;
color: #002f34;
text-align: center;
background: #fff;
border-radius: 30px;
box-shadow: 0px 3px 5px #a9a9a9;
}
.login {
padding-right:10px;
text-decoration: underline;
font-size: 18px;
font-weight: bold;
}
.flex-1{
flex: 1;
}
.flex-2{
flex: 2;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand logo" href="#">
<img src={require("../ui/logo.png")} />
</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav flex-2 pr-3">
<li class="input-group input-group-lg location mr-4 flex-1">
<input type="text" class="form-control" placeholder="Pakistan" />
<div class="input-group-btn">
<button class="fas fa-search ico"></button>
</div>
</li>
<li class="input-group input-group-lg search flex-2">
<input type="text" class="form-control" placeholder="Find Mobile, Car ,laptop" />
<div class="input-group-btn">
<button class="fas fa-search ico"></button>
</div>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<h6 class="mr-sm-2 login" >Login</h6>
<button class="my-2 my-sm-0 fas fa-plus sell"> SELL</button>
</form>
</div>
</nav>
You can achieve this using flexbox.
You can make your content sit inside a bootstrap row and then use col inside the row. The col allows you to specify what portion of the width is occupied by a particular column. There are 12 columns in all so you can make your country occupy 2 columns, login and sell occupy another 2 columns and give the remaining 8 columns to the input field.
You can also write your own css where the containing div has display of flex. Then you can use the flex properties on the items inside to control what portion of the available space they occupy.
I would recommend that you take some time to read how layout works in the web by going through MDN
image image2I'm trying to build a profile card in Bootstrap 3 and I'm having trouble getting the image to fit into the card. I think I can do this easier if I link to image in the css but I have many profile cards with all different people so I think keeping the image link in the HTML is better in this case.
Here's how I'd like it:
Any help is greatly appreciated. Thanks!
body {
font-family: 'Poppins';
overflow: hidden;
}
.navbar-inverse {
background-color: #fff !important;
border-color: #ffffff !important;
border-bottom: 1px solid #979797 !important;
}
#media (min-width: 768px){
.navbar {
border-radius: 0px !important;
}
}
.color-1{
color: #FCB900;
}
.sidebar{
color: #FCB900;
font-size: 21px;
float: left;
padding: 10px 5px;
cursor: pointer;
margin: 0 10px;
}
.logo a{
color: #424242 !important;
}
.logo{
background: white;
margin: 10px;
border: 1px solid #979797;
padding: 5px 20px;
font-size: 14px;
font-weight: 600;
}
.logo-a{
padding: 0 !important;
font-size: 13px !important;
}
/* Sidebar CSS */
.sidebar-logo{
background: white;
margin: 10px;
border: 1px solid #979797;
padding: 10px 20px;
font-size: 14px;
width: 50%;
margin-left: 10%;
text-align: center;
font-weight: 600;
}
.sidebar-title{
margin-left: 10%;
font-size: 12px;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #fcb900;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav a {
padding: 12px 8px 10px 25px;
text-decoration: none;
font-size: 14px;
color: #101010;
display: block;
transition: 0.3s;
}
.sidenav a:hover {
color: #101010;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 15px;
font-size: 25px;
margin-left: 50px;
}
.cart-icon{
font-size: 16px;
}
/*------------------------Profile Account----------------------------*/
.widget-author {
margin-bottom: 58px;
}
.author-card {
position: relative;
padding-bottom: 48px;
background-color: #fff;
box-shadow: 0 12px 20px 1px rgba(64, 64, 64, .09);
}
.author-card .author-card-cover {
position: relative;
width: 100%;
height: 100px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.author-card .author-card-cover::after {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
content: '';
opacity: 0.5;
}
.author-card .author-card-cover > .btn {
position: absolute;
top: 12px;
right: 12px;
padding: 0 10px;
}
.author-card .author-card-profile {
display: table;
position: relative;
margin-top: -85px;
padding-right: 15px;
padding-bottom: 16px;
padding-left: 20px;
z-index: 5;
}
.author-card .author-card-profile .author-card-avatar, .author-card .author-card-profile .author-card-details {
display: table-cell;
vertical-align: middle;
}
.author-card .author-card-profile .author-card-avatar {
width: 85px;
border-radius: 50%;
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, .15);
overflow: hidden;
}
.author-card .author-card-profile .author-card-avatar > img {
display: block;
width: 100%;
}
.author-card .author-card-profile .author-card-details {
padding-top: 50px;
padding-left: 15px;
}
.author-card .author-card-profile .author-card-name {
margin-bottom: 2px;
font-size: 14px;
font-weight: bold;
}
.author-card .author-card-profile .author-card-position {
display: block;
color: #8c8c8c;
font-size: 12px;
font-weight: 600;
}
.author-card .author-card-info {
margin-bottom: 0;
padding: 0 25px;
font-size: 13px;
}
.author-card .author-card-social-bar-wrap {
position: absolute;
bottom: -18px;
left: 0;
width: 100%;
}
.author-card .author-card-social-bar-wrap .author-card-social-bar {
display: table;
margin: auto;
background-color: #fff;
box-shadow: 0 12px 20px 1px rgba(64, 64, 64, .11);
}
.btn-style-1.btn-white {
background-color: #fff;
}
.list-group-item i {
display: inline-block;
margin-top: -1px;
margin-right: 8px;
font-size: 1.2em;
vertical-align: middle;
}
.mr-1, .mx-1 {
margin-right: .25rem !important;
}
.list-group-item.active:not(.disabled) {
border-color: #e7e7e7;
background: #fff;
color: #ac32e4;
cursor: default;
pointer-events: none;
}
.list-group-flush:last-child .list-group-item:last-child {
border-bottom: 0;
}
.list-group-flush .list-group-item {
border-right: 0 !important;
border-left: 0 !important;
}
.list-group-flush .list-group-item {
border-right: 0;
border-left: 0;
border-radius: 0;
}
.list-group-item.active {
z-index: 2;
color: #fff;
background-color: #007bff;
border-color: #007bff;
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: .25rem;
border-bottom-left-radius: .25rem;
}
a.list-group-item, .list-group-item-action {
color: #404040;
font-weight: 600;
}
.list-group-item {
padding-top: 16px;
padding-bottom: 16px;
-webkit-transition: all .3s;
transition: all .3s;
border: 1px solid #e7e7e7 !important;
border-radius: 0 !important;
color: #404040;
font-size: 12px;
font-weight: 600;
letter-spacing: .08em;
text-transform: uppercase;
text-decoration: none;
}
.list-group-item {
position: relative;
display: block;
padding: .75rem 1.25rem;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid rgba(0,0,0,0.125);
}
.list-group-item.active:not(.disabled)::before {
background-color: #ac32e4;
}
.list-group-item::before {
display: block;
position: absolute;
top: 0;
left: 0;
width: 3px;
height: 100%;
background-color: transparent;
content: '';
}
#media screen and (max-height: 450px) {
.sidenav {
padding-top: 15px;
}
.sidenav a {
font-size: 15px;
}
}
#exTab1 .tab-content {
color : #FCB900;
background-color: #fff;
padding : 5px 15px;
}
#exTab2 h3 {
color : #FCB900;
background-color: #428bca;
padding : 5px 15px;
}
/* remove border radius for the tab */
#exTab1 .nav-pills > li > a {
border-radius: 0;
}
/* change border radius for the tab , apply corners on top*/
#exTab3 .nav-pills > li > a {
border-radius: 4px 4px 0 0 ;
}
#exTab3 .tab-content {
color : white;
background-color: #428bca;
padding : 5px 15px;
}
/* Sidebar CSS */
.navbar-inverse .navbar-nav>li>a:hover {
color: #333;
}
.banner{
background-image: url('img/banner.jpg');
background-position: center center;
background-size: 100%;
margin: 0;
width: 100%;
height: 250px;
}
#media (min-width: 320px) and (max-width: 600px) {
.logo{
border: 1px solid #fff;
}
.head{
border-bottom: 0px solid #fff !important;
}
.header-right{
display: none !important;
}
.logo-media{
background: white;
border: 1px solid #979797;
padding: 5px 20px;
font-size: 14px;
width: 50%;
text-align: center;
font-weight: 600;
}
.no-margin{
margin-top: 0px !important;
margin-bottom: 0px;
}
.icon{
position: absolute !important;
top: 11px;
right: 0px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Travelling | Account Settings </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" href="css/css.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<nav class="navbar navbar-inverse head">
<div class="container-fluid">
<span style="" onclick="openNav()" class="sidebar">☰</span>
<div class="navbar-header logo">
<a class="logo-media" href="#">Logo</a>
</div>
<div id="mySidenav" class="sidenav">
×
<div class="sidebar-logo">
<a class="logo-a" href="#">Logo</a>
</div>
<span class="sidebar-title">My Account</span>
<span class="glyphicon glyphicon-home p-r-10"></span> Home
<span class="glyphicon glyphicon-road p-r-10"></span> My Booking
<span class="glyphicon glyphicon-envelope p-r-10"></span> Messages
<span class="glyphicon glyphicon-user p-r-10"></span> Account
<hr style="display: block; height: 1px;border: 0; border-top: 1px solid black;margin: 1em 0; padding: 0; }">
<span class="sidebar-title">Settings</span>
Language
<hr style="display: block; height: 1px;border: 0; border-top: 1px solid black;margin: 1em 0; padding: 0; }">
<span class="sidebar-title">Information</span>
Customer Service
<hr style="display: block; height: 1px;border: 0; border-top: 1px solid black;margin: 1em 0; padding: 0; }">
<span class="fa fa-sign-in p-r-10" aria-hidden="true"></span>Login
<span class="fa fa-user-o p-r-10" aria-hidden="true"></span>Sign Up!
</div>
<ul class="nav navbar-nav navbar-right no-margin">
<li class="icon"><span class="glyphicon glyphicon-shopping-cart color-1 cart-icon "></span></li>
<li class="header-right">Login</li>
<li class="header-right">Sign Up</li>
</ul>
</div>
</nav>
<div class="container mt-5">
<div class="row">
<div class="col-lg-4 pb-5">
<!-- Account Sidebar-->
<div class="author-card pb-3">
<div class="author-card-cover">
<!-- <a class="btn btn-style-1 btn-white btn-sm" href="#" data-toggle="tooltip" title="" data-original-title="You currently have 290 Reward points to spend"><i class="fa fa-award text-md"></i> 290 points</a> --></div>
<div class="author-card-profile">
<div class="author-card-avatar"><img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="Daniel Adams">
</div>
<div class="author-card-details">
<h5 class="author-card-name text-lg">Daniel Adams</h5><span class="author-card-position">Joined February 06, 2017</span>
</div>
</div>
</div>
<div class="wizard">
<nav class="list-group list-group-flush">
<a class="list-group-item" href="#">
<div class="d-flex justify-content-between align-items-center">
<div><i class="fe-icon-heart mr-1 text-muted"></i>
<div class="d-inline-block font-weight-medium text-uppercase">Account Setting</div>
</div>
</div>
</a>
<a class="list-group-item" href="#">
<div class="d-flex justify-content-between align-items-center">
<div><i class="fe-icon-heart mr-1 text-muted"></i>
<div class="d-inline-block font-weight-medium text-uppercase">My Booking</div>
</div>
</div>
</a>
<a class="list-group-item" href="#">
<div class="d-flex justify-content-between align-items-center">
<div><i class="fe-icon-tag mr-1 text-muted"></i>
<div class="d-inline-block font-weight-medium text-uppercase">Wish List</div>
</div>
</div>
</a>
</nav>
</div>
</div>
<!-- Profile Settings-->
<div class="col-lg-8 pb-5">
<!-- <form class="row">
<div class="col-md-6">
<div class="form-group">
<label for="account-fn">First Name</label>
<input class="form-control" type="text" id="account-fn" value="Daniel" required="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="account-ln">Last Name</label>
<input class="form-control" type="text" id="account-ln" value="Adams" required="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="account-email">E-mail Address</label>
<input class="form-control" type="email" id="account-email" value="daniel.adams#example.com" disabled="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="account-phone">Phone Number</label>
<input class="form-control" type="text" id="account-phone" value="+7 (805) 348 95 72" required="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="account-pass">New Password</label>
<input class="form-control" type="password" id="account-pass">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="account-confirm-pass">Confirm Password</label>
<input class="form-control" type="password" id="account-confirm-pass">
</div>
</div>
<div class="col-12">
<hr class="mt-2 mb-3">
<div class="d-flex flex-wrap justify-content-between align-items-center">
<div class="custom-control custom-checkbox d-block">
<input class="custom-control-input" type="checkbox" id="subscribe_me" checked="">
<label class="custom-control-label" for="subscribe_me">Subscribe me to Newsletter</label>
</div>
<button class="btn btn-style-1 btn-primary" type="button" data-toast="" data-toast-position="topRight" data-toast-type="success" data-toast-icon="fe-icon-check-circle" data-toast-title="Success!" data-toast-message="Your profile updated successfuly.">Update Profile</button>
</div>
</div>
</form> -->
<h1>Account Settings </h1>
<div id="exTab1">
<ul class="nav nav-pills">
<li>
Personal Information
</li>
<li>Travel
</li>
<li>Security
</li>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane" id="1a">
<form class="row">
<div class="col-md-4">
<div class="form-group">
<label for="First Name">First Name*</label>
<input class="form-control" type="text" id="account-fn" placeholder="First Name" required="">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="Last Name">Last Name*</label>
<input class="form-control" type="text" id="account-ln" placeholder="Last Name" required="">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="gender">Gender</label>
<select class="form-control" id="sel1" placeholder="Gender">
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="First Name">First Name*</label>
<input class="form-control" type="text" id="account-fn" placeholder="First Name*" required="">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="Last Name">Last Name*</label>
<input class="form-control" type="text" id="account-ln" placeholder="Last Name*" required="">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="Passport No.">Passport No.</label>
<input class="form-control" type="password" id="account-pass">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Date of Birth">Date of Birth</label>
<input class="form-control" type="date" value="2011-08-19" id="example-date-input">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="Country">Country</label>
<select class="selectpicker countrypicker form-control" data-flag="true" ></select>
</div>
</div>
<div class="col-12">
<hr class="mt-2 mb-3">
<div class="d-flex flex-wrap justify-content-between align-items-center">
<button class="btn btn-style-1 btn-primary" type="button" data-toast="" data-toast-position="topRight" data-toast-type="success" data-toast-icon="fe-icon-check-circle" data-toast-title="Success!" data-toast-message="Your profile updated successfuly.">Update Profile</button>
</div>
</div>
</form>
</div>
<div class="tab-pane" id="2a">
<h3>We use the class nav-pills instead of nav-tabs which automatically creates a background color for the tab</h3>
</div>
<div class="tab-pane" id="3a">
<h4> Change Password </h4>
<form>
<div class="form-group">
<label for="email" style="color:#2EC4B6">Current Password *</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Current Password">
</div>
<div class="form-group">
<label for="email" style="color:#2EC4B6">New Password *</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group">
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Confirm Password">
</div>
<button type="submit" class="btn" style="background: #FCB900; color:#fff;">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
</script>
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker();
});
</script>
</body>
</html>
Maybe you should consider something like this! :)
.author-card-shape {
width: 85px;
height: 85px;
border-radius: 50%;
overflow: hidden;
}
.author-card-img {
max-width: 100%;
height: auto;
}
<figure class="author-card-shape">
<img class="author-card-img" src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="Daniel Adams">
</figure>