<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css">
<div class="col-6">
<div class="cell">
<div class="d-flex justify-content-center">
<h1>Product</h1>
</div>
</div>
<div class="cell">
<hr class="w-100" size="5" />
</div>
<div class="cell">
<h3>price €</h1>
</div>
<div class="cell">
<hr class="w-100" size="5" />
</div>
<div class="cell">
<p class="lead">ART_DESIGNATION</p>
</div>
<div class="align-text-bottom">
<div class="cell">
<form class="position-fixed" action="" method="GET">
<div style="display: inline;">
<label>Quantité </label>
<input style="" type="number" placeholder="1" class="form-control">
<button style="" type="submit" class="btn btn-primary">Ajouter au panier</button>
</div>
</form>
</div>
</div>
</div>
The Web page :
I would like to put the form (label, input, button) in 1 line and to the bottom of the like this :
But I can't do it
Can you help me ?
I try to use bootsrap class for put buttom and also make my own CSS property but either it doesn't give a correct result or it doesn't do anything... I try to do tha this post say but that do nothing for me and i didnt want to up an old post : How to align div to bottom inside div bootstrap
You need to use Bootstrap grid properly.
See the snippet below.
.col-6 {
border: 1px solid red;
height: 500px;
}
img {
object-fit: cover;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css">
<div class="row">
<div class="col-6">
<img class="w-100 h-100" src="https://animals.sandiegozoo.org/sites/default/files/2016-11/animals_hero_giraffe_1_0.jpg" alt="">
</div>
<div class="col-6">
<div class="row align-self-end h-100">
<div class="col-12">
<div class="cell">
<div class="d-flex justify-content-center">
<h1>Product</h1>
</div>
</div>
<div class="cell">
<hr class="w-100" size="5" />
</div>
<div class="cell">
<h3>price €</h3>
</div>
<div class="cell">
<hr class="w-100" size="5" />
</div>
<div class="cell">
<p class="lead">ART_DESIGNATION</p>
</div>
</div>
<div class="col-12 d-flex align-items-end">
<div class="cell">
<form action="" method="GET">
<div style="display: inline;">
<label>Quantité </label>
<input style="" type="number" placeholder="1" class="form-control">
<button style="" type="submit" class="btn btn-primary">Ajouter au panier</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
Related
I have a simple web page template.my problem is that, my web page has a horizontal scroll. But I want remove it. This is my code:
<html lang="FA">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body dir="rtl">
<section class="bg-blue">
<div class="container">
<div class="text-center">
<img src="logo.png" alt="">
<h2 class="logo-text d-inline-block p-4 ps-0">My logo text</h2>
</div>
</div>
<div class="row">
<div class="col-12">
<img src="" alt="">
</div>
</div>
</section>
<section class="bg-secondary">
<div class="container">
<div class="text-center" style="height: 800px;">
<div class="search-container">
<div class="search-form">
<input type="text" class="form-control search-field w-50" placeholder="search">
</div>
</div>
</div>
</div>
</section>
<footer class="bg-yellow">
<div class="container">
</div>
</footer>
</body>
</html>
This is screen shot of result:
Any solution?
Try setting the body css using the overflow-x property for horizontal scrollbars like this:
.body{
overflow-x:hidden;
}
overflow: hidden; is fine to use. But I suggest looking at your markup. Bootstrap adds a margin-left & margin-right to the row class. In this case margin-right is the culprit.
Try it like this:
Rearranged Markup:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<section class="bg-blue">
<div class="container">
<div class="row">
<div class="text-center">
<img src="logo.png" alt="">
<h2 class="logo-text d-inline-block p-4 ps-0">My logo text</h2>
</div>
</div>
<div class="col-12">
<img src="" alt="">
</div>
</div>
</section>
<section class="bg-secondary">
<div class="container">
<div class="text-center" style="height: 800px;">
<div class="search-container">
<div class="search-form">
<input type="text" class="form-control search-field w-50" placeholder="search">
</div>
</div>
</div>
</div>
</section>
<footer class="bg-yellow">
<div class="container">
</div>
</footer>
Original Markup:
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<section class="bg-blue">
<div class="container">
<div class="text-center">
<img src="logo.png" alt="">
<h2 class="logo-text d-inline-block p-4 ps-0">My logo text</h2>
</div>
</div>
<div class="row">
<div class="col-12">
<img src="" alt="">
</div>
</div>
</section>
<section class="bg-secondary">
<div class="container">
<div class="text-center" style="height: 800px;">
<div class="search-container">
<div class="search-form">
<input type="text" class="form-control search-field w-50" placeholder="search">
</div>
</div>
</div>
</div>
</section>
<footer class="bg-yellow">
<div class="container">
</div>
</footer>
put the class="row" div inside container div
<div class="container">
<div class="text-center">
<img src="logo.png" alt="">
<h2 class="logo-text d-inline-block p-4 ps-0">My logo text</h2>
</div>
<div class="row">
<div class="col-12">
<img src="" alt="">
</div>
</div>
</div>
I am trying to make "navbar/toolbar" which has one item at left (h3) and 3 items on right (a, a and select). The problem is that I want them all to be vertically centered which is working only on my first item (h3). Why it is like that?
This is the example:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col">
<div class="d-flex">
<div class="align-self-center">
<h3 class="pl-4">
Title
</h3>
</div>
<div class="ml-auto">
<a class="" href="javascript:void();">
1
</a>
<a class="" href="javascript:void();">
2
</a>
<div class="form-group" style="display: inline-block;">
<select class="form-control" >
<option>1</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
How should I align everything center vertically? Any help is appreciated.
Apply align-self-center on div which enclosing anchor tags and select. Also remove class form-group from the div which enclosing select because it's applying margin-bottom on select and because of that it does not seem to be in the center.
Here is the code changes which I explained:
<div class="container">
<div class="row">
<div class="col">
<div class="d-flex">
<div class="align-self-center">
<h3 class="pl-4">
Title
</h3>
</div>
<div class="ml-auto align-self-center">
<a class="" href="javascript:void();">
1
</a>
<a class="" href="javascript:void();">
2
</a>
<div style="display: inline-block;">
<select class="form-control" >
<option>1</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
Just remove the "align-self-center" class. check updated code.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container" style="padding:20px;">
<div class="row">
<div class="col">
<div class="d-flex">
<div>
<h3 class="pl-4">
Title
</h3>
</div>
<div class="ml-auto">
<a class="" href="javascript:void();">
1
</a>
<a class="" href="javascript:void();">
2
</a>
<div class="form-group" style="display: inline-block;">
<select class="form-control" >
<option>1</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
add align-self-center class to parent div that contains all child
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col">
<div class="d-flex align-self-center">
<h3 class="pl-4">
Title
</h3>
<div class="ml-auto">
<a class="" href="javascript:void();">
1
</a>
<a class="" href="javascript:void();">
2
</a>
<div class="form-group" style="display: inline-block;">
<select class="form-control" >
<option>1</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
I'm a beginner when it comes to CSS styling. Can anyone tell me why the surname input box is aligned differently (not left aligned to the 'surname' section) and why the payroll id input box - while much closer - still has a gap between the text box and the 'payroll #' panel? The HTML is exactly the same for both input boxes?
Code as per edit suggestion:
<div class="round-div" style="border:2px solid #428bca;">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<div class="admin-wall">
<div class="container text-center">
<div class="row">
<img class="img-responsive center-block" style="float:inherit" src="https://s3-ap-southeast-2.amazonaws.com/jdm-my-dev-bucket/australianpharmaceuticalindustrieslogoh.png" />
</div>
<span class="border border-info">
<h1 style="color:#428bca;font-weight:bold">We Love Your Work</h1>
<h4>"Celebrating our people for demonstrating safety, health & wellbeing and our values"</h4>
<div class="panel-info">
<div class="panel-body">
<div class="row">
<div class="input-group">
<span class="input-group-addon" id="inputSurname">Surname</span>
<input type="text" class="form-control" placeholder="Smith" aria-describedby="inputSurname">
</div>
</div>
<div class="row">
<div class="input-group">
<span class="input-group-addon" id="inputPayrollId">Payroll #</span>
<input type="password" class="form-control" placeholder="53677" aria-describedby="inputPayrollId">
</div>
</div>
</div>
</div>
<div class="container text-center">
<div class="row">
<img class="img-responsive center-block" style="float:inherit" src="https://s3-ap-southeast-2.amazonaws.com/jdm-my-dev-bucket/wlyw_footer.png" />
</div>
<div class="row">
<h6><small><asp:Label ID="Lblversion" runat="server"></asp:Label></small></h6>
</div>
</div>
</span>
</div>
</div>
</div>
</div>
</div>
Use This
<div class="container">
<div class="input-group col-md-12">
// Do Your First Input Group
</div>
<div class="input-group col-md-12">
// Do Your Second Input Group
</div>
</div>
I have a banner inside a fluid container, but I want the banner width to be fixed after 1400px width and center aligned. I dont want it to stretch more than that. Is there a simple way to do this ?
Here's my HTML
<div class="container-fluid blue_back">
<div class="container-fluid ">
<div class="row banner-content">
<div class="col-md-12">
<div class="row nav1 search search_bar1" role="navigation">
<div class="container-fluid">
<div class="navbar-header navbar_search">
<form class="navbar-form form1 " role="search">
<select class="selectbox1 form_input" >
<option> Search in Hospitals </option>
<option> Search in Packages </option>
<option> Search in Diagnostics </option>
<option> Search in Doctors </option>
<option> Search in Tests </option>
</select>
<input type="text" class="form_input" placeholder="Type Hospital Name" name="srch-term" id="srch-term">
<input type="text" class="form_input" placeholder="Type Location" name="srch-term" id="srch-term">
<input type="text" class="form_input" placeholder="Type Speciality" name="srch-term" id="srch-term">
<button class="form_button" type="submit"></button>
</form>
</div>
</div>
</div>
<div class="row social_media aa">
<input type="submit" value="Book Appointment" class="appointment_book_home" />
<input type="submit" value="" class="search_book_home"/>
<ul class="list-inline list-unstyled social_media_icons">
<li><img src="images/facebook.png"/> </li>
<li><img src="images/google.png"/> </li>
<li><img src="images/twitter.png"/> </li>
</ul>
</div>
<div class="row statistics_home">
<div class="col-xs-4 dashed_border">
<div class="row">
<div class="col-sm-2 stat_image">
<img src="images/List/hospital_icon_menu.png"/>
</div>
<div class="col-sm-10 ">
<div class="row">
<h3 class="statistics_head"> 800+ </h3>
</div>
<div class="row">
<h4 class="statistics_text"> Health Centres </h4>
</div>
</div>
</div>
</div>
<div class="col-xs-4 dashed_border">
<div class="row">
<div class="col-sm-2 stat_image">
<img src="images/List/hospital_icon_menu.png"/>
</div>
<div class="col-sm-10 ">
<div class="row">
<h3 class="statistics_head"> 800+ </h3>
</div>
<div class="row">
<h4 class="statistics_text"> Packages and Tests </h4>
</div>
</div>
</div>
</div>
<div class="col-xs-4 dashed_border" style="border: none;">
<div class="row">
<div class="col-sm-2 stat_image">
<img src="images/List/hospital_icon_menu.png"/>
</div>
<div class="col-sm-10 ">
<div class="row">
<h3 class="statistics_head"> 800+ </h3>
</div>
<div class="row">
<h4 class="statistics_text"> Doctors </h4>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
And this is my CSS
.banner-content {
background: url('http://localhost:8383/Buzz_HomePage/images/homeimage1.jpg') no-repeat center center;
background-size: cover;
height: 290px;
}
If I understand your question correctly, you should add this css:
.banner-content {
width:100%;
max-width:1350px;
margin:0 auto;
}
If you need more help, you might try posting a JSfiddle.
<body>
This section should be on the right of all three rows as md-4 columns that are vertically the height of the three rows to the left.
TEXT
<form action="php" class=
"form-contact" data-ajax-fail-msg=
"Ajax could not set the request"
data-all-fields-required-msg="All fields are required"
data-success-msg="Email successfully sent." id=
"contact-form-agent" method="post" name=
"contact-form-agent">
<input name="name" placeholder="Full Name" type="text">
<input name="email" placeholder="E-mail" type="text">
<input name="title" placeholder="Title" type="text">
<input name="company" placeholder="Company" type=
"text">
<textarea name="message" placeholder=
"Tell us What Keeps You Up At Night">
</textarea> <input class="submit-alt pull-right" type="submit"
value="Get Started">
<p class="return-msg">
</p>
</form>
</div>
Above is the code for the submit fields to enter for the php.
Below is the 2nd md-4 image under the form submit fields.
<div class="col-md-4 onscroll-animate" data-animation=
"fadeInUp">
<br>
<br>
<a href=""><img alt="" height=
"190" src="images/assets/video-thumb-A.png" width=
"331"></a>
<h3>SEE FOR YOURSELF</h3>
<br>
</div>
</div>
</div>
</section>
This section is the three rows as md-8 completing the 12 row bootstrap columns.
<section>
<div class="section-content">
<div class="container">
<section id="listings-section">
<div class="section-content">
<div class="section-header onscroll-animate"
data-animation="fadeInLeft">
<p>TEXT</p>
</div>
<div class="row">
<div class="col-md-12">
<div class="profile">
<div class="row">
<div class="col-xs-4">
<div class="profile-img"><img alt=
"store-icon" src=
"images/icons/store-icon.png">
</div>
</div>
<div class=
"col-xs-8 text-left onscroll-animate"
data-animation="fadeInUp">
<h5 class="profile-heading">
</h5>
<p>
</p>
<div class="profile-cotent">
<h3 class=
"section-small-heading">TEXT</h3>
</div>
</div>
</div>
<!-- .row -->
</div>
<!-- .profile -->
</div>
<!-- .col-md-8 -->
</div>
<!-- .row -->
</div>
<!-- .section-content -->
</section>
<div class="section-header onscroll-animate" data-animation=
"fadeInLeft">
<p>TEXT</p>
</div>
<div class="col-md-12">
<div class="profile">
<div class="row">
<div class="col-xs-4">
<div class="profile-img"><img alt="hand-icon"
src="images/icons/hand-icon.png">
</div>
</div>
<div class="col-xs-8 text-left onscroll-animate"
data-animation="fadeInUp">
<h5 class="profile-heading">
</h5>
<p>
</p>
<div class="profile-cotent">
<h3 class="section-small-heading">TEXT</h3>
</div>
</div>
</div>
<!-- .row -->
</div>
<!-- .profile -->
</div>
<!-- .col-md-12 -->
<!--AMP SECTION 3-->
<div class="section-header onscroll-animate" data-animation=
"fadeInLeft">
<p>TEXT</p>
</div>
<div class="col-md-12">
<div class="profile">
<div class="row">
<div class="col-xs-4">
<div class="profile-img"><img alt="store-icon"
src="images/icons/computer-icon.png">
</div>
</div>
<div class="col-xs-8 text-left onscroll-animate"
data-animation="fadeInUp">
<h5 class="profile-heading">
</h5>
<div class="profile-cotent">
<h3 class="section-small-heading">TEXT</h3>
</div>
</div>
</div>
<!-- .row -->
</div>
<!-- .profile -->
</div>
<!-- .col-md-12 -->
<div class="col-md-12">
<div class="profile">
<div class="row">
<div class="profile-cotent">
<h3 class="section-small-heading">TEXT</h3>
</div>
</div>
</div>
<!-- .row -->
</div>
<!-- .profile -->
</div>
<!-- .col-md-12 -->
</div>
</section>
<!-- .col-md-3 -->
<!-- .row -->
<!-- .container -->
<!-- .section-content -->
Please help and thank you.
</body>
</html>
Your basic nested row should do:
<div class="container">
<div class="row">
<div class="col-xs-8">
<div class="row">
<div class="col-xs-12"> ... </div>
<div class="col-xs-12"> ... </div>
<div class="col-xs-12"> ... </div>
</div>
</div>
<div class="col-xs-4"> ... </div>
</div>
</div>
http://getbootstrap.com/css/#grid-nesting