This question already has answers here:
How do you get the footer to stay at the bottom of a Web page?
(32 answers)
Closed 3 years ago.
"When an HTML page contains a small amount of content, the footer can sometimes sit halfway up the page leaving a blank space underneath."
And thats exactly whats happening when somebody opens this page on a larger screen. I found solutions online on how to fix this, but I do not know where to apply what.
I tried these and a few more without success. They must be working, I just didn't know how to apply them.
https://www.freecodecamp.org/news/how-to-keep-your-footer-where-it-belongs-59c6aa05c59c/
https://matthewjamestaylor.com/bottom-footer
https://codepen.io/cbracco/pen/zekgx
<html lang="en">
<head>
<title>About Project</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Work+Sans:400,700,900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-datepicker.css">
<link rel="stylesheet" href="css/jquery.fancybox.min.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<link rel="stylesheet" href="fonts/flaticon/font/flaticon.css">
<link rel="stylesheet" href="css/aos.css">
<!-- MAIN CSS -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/form.css">
</head>
<body data-spy="scroll" data-target=".site-navbar-target" data-offset="300">
<div class="site-wrap" id="home-section">
<div class="site-mobile-menu site-navbar-target">
<div class="site-mobile-menu-header">
<div class="site-mobile-menu-close mt-3">
<span class="icon-close2 js-menu-toggle"></span>
</div>
</div>
<div class="site-mobile-menu-body"></div>
</div>
<header class="site-navbar site-navbar-target" role="banner">
<div class="container">
<div class="row align-items-center position-relative">
<div class="col-3 ">
<div class="site-logo">
<a href="index.php" class="font-weight-bold">
<img src="images/logo.png" alt="Image" class="img-fluid">
</a>
</div>
</div>
<div class="col-9 text-right">
<span class="d-inline-block d-lg-none"><span class="icon-menu h3 text-white"></span></span>
<nav class="site-navigation text-right ml-auto d-none d-lg-block" role="navigation">
<ul class="site-menu main-menu js-clone-nav ml-auto ">
<li>Home</li>
<div class="dropdown">
<p id="ddm" class="dropbtn">Types of Violence ▾</p>
<div class="dropdown-content">
<a id="f" href="fizicko.php">Physical </a>
<a id="s" href="seksualno.php">Sexual </a>
<a id="p" href="psiholosko.php">Psychological </a>
<a id="d" href="digitalno.php">Digital </a>
</div>
</div>
<li>Simulation</li>
<li><span style="color:rgba(255, 215, 0,0.9);">About Project</span></li>
<li><?php include_once 'jezici.php'; ?></li>
</ul>
</nav>
</div>
</div>
</div>
</header>
</div>
</div>
<div class="row" style="padding: 50px;">
<div class="col-12 col-md-6">
<h2 class="h1-responsive font-weight-bold text-center my-4">About project</h2>
<div class="row">
<div class="col-md-12 mb-md-0 mb-5">
<p>The project is intended primarily for high school and elementary school students, but it can also be useful for the elderly. It consists of two main parts, informative and interactive.</p>
<p>The informative section aims to present to the site visitors what are the most common forms of violence in schools and how they can be prevented.</p>
<p>The interactive part is based on a simulation of a conversation between a user and another person, with the conversation having a different outcome relative to the answers.</p>
<hr><p>The goal of this project is to raise awareness of the severity of peer violence, how much concequences it can cause if no one responds, and general education about peer violence.</p>
</div>
</div>
</div>
<div class="col-12 col-md-6">
<h2 class="h1-responsive font-weight-bold text-center my-4">Contact us</h2>
<p class="text-center w-responsive mx-auto mb-5">Have a question? Contact us directly via email, and we will respond as soon as possible.</p>
<div class="row">
<div class="col-md-12 mb-md-0 mb-5">
<form id="contact-form" name="contact-form" action="kontakt.php" method="POST">
<div class="row">
<div class="col-md-6">
<div class="md-form mb-0">
<input type="text" id="name" name="name" class="form-control">
<label for="name" class="">Name</label>
</div>
</div>
<div class="col-md-6">
<div class="md-form mb-0">
<input type="text" id="email" name="email" class="form-control">
<label for="email" class="">Email</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="md-form mb-0">
<input type="text" id="subject" name="subject" class="form-control">
<label for="subject" class="">Subject</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="md-form">
<textarea type="text" id="message" name="message" rows="2" class="form-control md-textarea"></textarea>
<label for="message" >Message</label>
</div>
</div>
</div>
</form>
<div class="text-center text-md-left">
<a style="float: right;" class="btn btn-primary" onclick="document.getElementById('contact-form').submit();">Send</a>
</div>
<div class="status"></div>
</div>
</div>
</div>
</div>
<footer style="width: 100%; text-align: center; background-color: #002366;">
<div style="display: inline-block; margin-left: 5px; margin-right: 15px;">
<b><p class="ftprijavimup" style="color:rgba(255, 215, 0,0.9); margin-top: 5px;">Report<br>violence</p></b>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS violence in schools<br>(7.30-15.30h) <span style="color:rgba(255, 215, 0,0.9);">0800 200201</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;" >SOS CENTER FOR YOUTH<br>(18-22h) <span style="color:rgba(255, 215, 0,0.9);">3192 782</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS INTERNET VIOLENCE <br>(7.30-15.30h) <span style="color:rgba(255, 215, 0,0.9);">198 33</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS WOMEN'S CENTER<br>(10-20h) <span style="color:rgba(255, 215, 0,0.9);">2645 328</span></p>
</div>
</footer>
</body>
</html>
Try this.
Looks like your are using bootstrap
https://getbootstrap.com/docs/4.0/examples/sticky-footer/
https://startbootstrap.com/snippets/sticky-footer-flexbox/
First of all, wrap everything in the .site-wrap div as I did below. Add the classes d-flex flex-column to your body element and then add this CSS to that
html,body{
height: 100%
}
.site-wrap{
flex-grow:1;
}
Working Snippet here
html,body{
height: 100%
}
.site-wrap{
flex-grow:1;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<html lang="en">
<head>
<title>About Project</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Work+Sans:400,700,900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-datepicker.css">
<link rel="stylesheet" href="css/jquery.fancybox.min.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<link rel="stylesheet" href="fonts/flaticon/font/flaticon.css">
<link rel="stylesheet" href="css/aos.css">
<!-- MAIN CSS -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/form.css">
</head>
<body data-spy="scroll" class="site-mobile-menu d-flex flex-column" data-target=".site-navbar-target" data-offset="300">
<div class="site-wrap" id="home-section">
<div class="site-navbar-target">
<div class="site-mobile-menu-header">
<div class="site-mobile-menu-close mt-3">
<span class="icon-close2 js-menu-toggle"></span>
</div>
</div>
<div class="site-mobile-menu-body"></div>
</div>
<header class="site-navbar site-navbar-target" role="banner">
<div class="container">
<div class="row align-items-center position-relative">
<div class="col-3 ">
<div class="site-logo">
<a href="index.php" class="font-weight-bold">
<img src="images/logo.png" alt="Image" class="img-fluid">
</a>
</div>
</div>
<div class="col-9 text-right">
<span class="d-inline-block d-lg-none"><span class="icon-menu h3 text-white"></span>
</span>
<nav class="site-navigation text-right ml-auto d-none d-lg-block" role="navigation">
<ul class="site-menu main-menu js-clone-nav ml-auto ">
<li>Home</li>
<div class="dropdown">
<p id="ddm" class="dropbtn">Types of Violence ▾</p>
<div class="dropdown-content">
<a id="f" href="fizicko.php">Physical </a>
<a id="s" href="seksualno.php">Sexual </a>
<a id="p" href="psiholosko.php">Psychological </a>
<a id="d" href="digitalno.php">Digital </a>
</div>
</div>
<li>Simulation</li>
<li><span style="color:rgba(255, 215, 0,0.9);">About Project</span></li>
<li>
<?php include_once 'jezici.php'; ?>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<div class="row" style="padding: 50px;">
<div class="col-12 col-md-6">
<h2 class="h1-responsive font-weight-bold text-center my-4">About project</h2>
<div class="row">
<div class="col-md-12 mb-md-0 mb-5">
<p>The project is intended primarily for high school and elementary school students, but it can also be useful for the elderly. It consists of two main parts, informative and interactive.</p>
<p>The informative section aims to present to the site visitors what are the most common forms of violence in schools and how they can be prevented.</p>
<p>The interactive part is based on a simulation of a conversation between a user and another person, with the conversation having a different outcome relative to the answers.</p>
<hr>
<p>The goal of this project is to raise awareness of the severity of peer violence, how much concequences it can cause if no one responds, and general education about peer violence.</p>
</div>
</div>
</div>
<div class="col-12 col-md-6">
<h2 class="h1-responsive font-weight-bold text-center my-4">Contact us</h2>
<p class="text-center w-responsive mx-auto mb-5">Have a question? Contact us directly via email, and we will respond as soon as possible.</p>
<div class="row">
<div class="col-md-12 mb-md-0 mb-5">
<form id="contact-form" name="contact-form" action="kontakt.php" method="POST">
<div class="row">
<div class="col-md-6">
<div class="md-form mb-0">
<input type="text" id="name" name="name" class="form-control">
<label for="name" class="">Name</label>
</div>
</div>
<div class="col-md-6">
<div class="md-form mb-0">
<input type="text" id="email" name="email" class="form-control">
<label for="email" class="">Email</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="md-form mb-0">
<input type="text" id="subject" name="subject" class="form-control">
<label for="subject" class="">Subject</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="md-form">
<textarea type="text" id="message" name="message" rows="2" class="form-control md-textarea"></textarea>
<label for="message">Message</label>
</div>
</div>
</div>
</form>
<div class="text-center text-md-left">
<a style="float: right;" class="btn btn-primary" onclick="document.getElementById('contact-form').submit();">Send</a>
</div>
<div class="status"></div>
</div>
</div>
</div>
</div>
</div>
<footer style="width: 100%; text-align: center; background-color: #002366;" clas="footer">
<div style="display: inline-block; margin-left: 5px; margin-right: 15px;">
<b><p class="ftprijavimup" style="color:rgba(255, 215, 0,0.9); margin-top: 5px;">Report<br>violence</p></b>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS violence in schools<br>(7.30-15.30h) <span style="color:rgba(255, 215, 0,0.9);">0800 200201</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" styhttps://stackoverflow.com/questions/60209899/footer-rising-up-because-of-not-sufficient-content#le="margin-top: 5px;">SOS CENTER FOR YOUTH<br>(18-22h) <span style="color:rgba(255, 215, 0,0.9);">3192 782</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS INTERNET VIOLENCE <br>(7.30-15.30h) <span style="color:rgba(255, 215, 0,0.9);">198 33</span></p>
</div>
<div class="col-lg-2.5" style="display: inline-block; margin-left: 5px; margin-right: 5px;">
<p class="ftprijavimup" style="margin-top: 5px;">SOS WOMEN'S CENTER<br>(10-20h) <span style="color:rgba(255, 215, 0,0.9);">2645 328</span></p>
</div>
</footer>
</body>
</html>
Did you tried with this:
footer {
position: absolute;
bottom: 0;
width: 100%;
}
I have integrated a chat bot onto a website which opens on the bottom right side of the screen on click of a button. I just need this bot to automatically fit all mobile/tablet screen devices on click of the button.
Note: I want the bot to occupy the whole screen for mobile/tablets devices.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<div class="container">
<button class="btn askQuestion"><img src="images/question.png" /> Ask a Question</button>
<div id="chat_window_1" class="row chat-window col-xs-6 col-md-4" style="margin-left:10px;">
<div class="col-xs-12 col-md-12">
<div class="panel panel-default noBorder">
<div class="panel-heading top-bar chat-heading">
<div class="col-md-8 col-xs-8 noLRP">
<h3 class="panel-title ChatTitle"><img src="images/32x32.png" class="titleImg" />DPOPlus Q&A</h3>
<!-- <img src="images/chat-logo.png" alt="Dominer" /> -->
</div>
<div class="col-md-4 col-xs-4" style="text-align: right;">
<!-- <span id="minim_chat_window" class="glyphicon glyphicon-minus icon_minim"></span>-->
<a id="expand" href="#"><span class="glyphicon glyphicon-new-window"></span></a>
<span class="glyphicon glyphicon-remove icon_close" data-id="chat_window_1"></span>
</div>
</div>
<div id="response" class="panel-body msg_container_base"></div>
<div id="footdiv" class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm chat_input" placeholder="Write your message..." />
<span class="input-group-btn">
<button class="btn btn-sm sendBtn" id="btn-chat"><img src="images/send.png"></button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
I have a multiple section accordion set up with two column. The page is setup something like this:
<div class="panel-group" id="Accordion">
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-parent="#Accordion" data-target="#ApplicantInfo">
<h4 class="panel-title">
<a class="accordion-toggle">
Applicant Information:
</a>
</h4>
</div>
<div id="ApplicantInfo" class="panel-collapse collapse in">
<div class="panel-body">
<div class="row">
<div id="divApplicant" class="col-xs-6">Applicant:</div>
<div id="divApplicantPhone" class="col-xs-6">Applicant Telephone:</div>
</div>
<div class="row spFieldRow">
<div class="col-xs-6">
<span dir="none">
<input id="applinantName" ...>
</span>
</div>
<div class="col-xs-6">
<span dir="none">
<input id="applinantPhone" ...>
</span>
</div>
</div>
<div class="row">
<div id="divApplicantEmail" class="col-xs-6">Applicant Email:</div>
<div id="divApplicantType" class="col-xs-6">Applicant Type:</div>
</div>
<div class="row spFieldRow">
<div class="col-xs-6">
<span dir="none">
<input id="applinantEmail" ...>
</span>
</div>
<div class="col-xs-6">
<span dir="none">
<input id="applinantType" ...>
</span>
</div>
</div>
</div>
</div>
</div>
For the most part it works very well. However, some of my fields are dynamic depending on the selection of one of the other fields. The problem I am running into is that if I remove say either of the input rows or even just the text box it shrinks the width of the panel.
I have attached a couple of pics to illustrate.
Before:
After:
I have tried affecting entire rows, I even added a div container around the label and input containers and hiding that. Doesn't matter, the second row shifts up and shrinks.
Please be kind, I am very new to bootstrap (my first time) and haven't done much front end development in recent years. I appreciate any assistance.
Edit:
I created a JSFiddle as close to this as possible and can't recreate the issue (you can find it here if you want).
I completely forgot to mention prior, but this page is sitting on a SharePoint site so there is all other kinds of css being loaded. My guess is one of them is getting in the way. If anyone has seen this before i would appreciate any input.
I am not sure this is what you are looking for but instead of dynamically adding the panels themselves, you can show/hide them at will.
(you can still dynamically add content to each panel as you see fit, just not the panels - they serve as containers for your dynamic content)
See demo below (select an applicant type in the dropdown box):
$(function() {
$("select").on("change", function() {
if ($(this).val() === 'Internal') {
$("#externalPanel").collapse('hide');
$("#internalPanel").removeClass('hide');
$("#internalPanel").collapse('show');
} else if ($(this).val() === 'External') {
$("#internalPanel").collapse('hide');
$("#externalPanel").removeClass('hide');
$("#externalPanel").collapse('show');
} else {
$(".secondary-panel").collapse('hide');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="panel-group" id="ADMSAccordion">
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-parent="#ADMSAccordion" data-target="#ApplicantInfo">
<h4 class="panel-title">
<a class="accordion-toggle">
Applicant Information:
</a>
</h4>
</div>
<div id="ApplicantInfo" class="panel-collapse collapse in">
<div class="panel-body">
<div class="row">
<div id="divApplicant" class="col-xs-6">Applicant:</div>
<div id="divApplicantPhone" class="col-xs-6">Applicant Telephone:</div>
</div>
<div class="row">
<div class="col-xs-6">
<input title="Applicant" type="text" maxlength="255" />
</div>
<div class="col-xs-6">
<input title="ApplicantPhone" type="text" maxlength="255" />
</div>
</div>
<div class="row">
<div id="divApplicantEmail" class="col-xs-6">Applicant Email:</div>
<div id="divApplicantType" class="col-xs-6">Applicant Type:</div>
</div>
<div class="row">
<div class="col-xs-6">
<input title="ApplicantEmail" type="text" maxlength="255" />
</div>
<div class="col-xs-6">
<select title="ApplicantType">
<option selected="Selected" value=""></option>
<option value="Internal">Internal</option>
<option value="External">External</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- External panel -->
<div id="externalPanel" class="panel panel-default hide secondary-panel">
<div class="panel-heading">
<h3 class="panel-title">External Panel</h3>
</div>
<div class="panel-body">
External Panel content
</div>
</div>
<!-- INternal panel -->
<div id="internalPanel" class="panel panel-default hide secondary-panel">
<div class="panel-heading">
<h3 class="panel-title">Internal Panel</h3>
</div>
<div class="panel-body">
Internal Panel content
</div>
</div>
Here is my issue, I would like to get a closed collapse on each project (h3) I know the first one has to be open, but I would like all the others to be closed. Actually, the collapse is working, but they are all "open"
I tried to minimize the code to let you see the most relevant so as you can see there is only 2 project but I can have more than a hundred I removed the php because he build what you can see there.
<div class="categorie">
<div class="row">
<div class="col-xs-12">
<div class="well-header" data-toggle="collapse" data-target=".collapse-csnm" aria-expanded="false" aria-controls="livraison_1_0 ">
<h3>CSNM</h3>
<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
</div>
<div class="well well-white test collapse-csnm in" id="livraison_1_0"
<div class="well-content">
<div class="row">
<blockquote class="recap">
<p class="labels">
<span class="label label-primary">Développement</span>
<span class="label label-default">Url</span>
<span id="state-projetcheklist-1" class="state state-nosmile"></span>
</p>
<p data-toggle="collapse" href="#site-1" aria-expanded="false" aria-controls="site">
Content
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="categorie">
<div class="row">
<div class="col-xs-12">
<div class="well-header" data-toggle="collapse" data-target=".collapse-salt-travel" aria-expanded="false" aria-controls="livraison_3_0 ">
<h3>Salt Travel</h3>
<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
</div>
<div class="well well-white test collapse-salt-travel in" id="livraison_3_0" <div class="well-content">
<div class="row">
<blockquote class="recap">
<p class="labels">
<span class="label label-primary">Intégration</span>
<span class="label label-default">Url</span>
<span id="state-projetcheklist-3" class="state state-nosmile"></span>
</p>
<p data-toggle="collapse" href="#structure-accueil-3" aria-expanded="false" aria-controls="structure-accueil">
Content
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
So do you know what to do to get the first one opened and all others closed ?
Thanks for you help.
There is a little mistake in your HTML replace all in class with collapse at div who has class well
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="categorie">
<div class="row">
<div class="col-xs-12">
<div class="well-header" data-toggle="collapse" data-target=".collapse-csnm" aria-expanded="false" aria-controls="livraison_1_0 ">
<h3>CSNM</h3>
<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
</div>
<div class="well well-white test collapse-csnm collapse" id="livraison_1_0"
<div class="well-content">
<div class="row">
<blockquote class="recap">
<p class="labels">
<span class="label label-primary">Développement</span>
<span class="label label-default">Url</span>
<span id="state-projetcheklist-1" class="state state-nosmile"></span>
</p>
<p data-toggle="collapse" href="#site-1" aria-expanded="false" aria-controls="site">
Content
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="categorie">
<div class="row">
<div class="col-xs-12">
<div class="well-header" data-toggle="collapse" data-target=".collapse-salt-travel" aria-expanded="false" aria-controls="livraison_3_0 ">
<h3>Salt Travel</h3>
<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
</div>
<div class="well well-white test collapse-salt-travel collapse" id="livraison_3_0" <div class="well-content">
<div class="row">
<blockquote class="recap">
<p class="labels">
<span class="label label-primary">Intégration</span>
<span class="label label-default">Url</span>
<span id="state-projetcheklist-3" class="state state-nosmile"></span>
</p>
<p data-toggle="collapse" href="#structure-accueil-3" aria-expanded="false" aria-controls="structure-accueil">
Content
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
I am working on a display where there are 3 checkboxes. When one of these checkboxes is triggered, a message or input field should appear. I got that part working, but the checkbox and the message are not aligned as shown in the image below
As you can see the "Ondertiteling" checkbox is not aligned with the text "Ondertitel enabled".
This is my code (with the toggling of the message ommitted for the question's sake)
.checkbox {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
}
.checkbox label {
min-height: 20px;
padding-left: 20px;
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span>Aanvraag #1</span>
<i class="fa fa-remove pull-right icon-clickable"></i>
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-3">
<div class="checkbox">
<label> <input type="checkbox">Ondertitels</label>
</div>
<div class="checkbox">
<label> <input type="checkbox">Vertaling</label>
</div>
<div class="checkbox">
<label><input type="checkbox">Voice-overs</label>
</div>
</div>
<div class="col-lg-9">
<div>Ondertitel enabled</div>
<div>Vertaling enabled</div>
<div class="text-danger">Voor voice-overs kan geen automatische prijsindicatie gegeven worden.</div>
</div>
</div>
</div>
</div>
</div>
</div>
How can I align the text to be on the same height as the checkbox? Thanks in advance.
I would ask to change your markup to fix the formatting so that bootstrap will handle it for us. Change the markup into rows such as this:
<div class="row">
<div class="col-lg-3">
<div class="checkbox">
<label><input type="checkbox">Vertaling</label>
</div>
</div>
<div class="col-lg-9">
<div class="checkbox">Vertaling enabled</div>
</div>
</div>
See demo below:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span>Aanvraag #1</span>
<i class="fa fa-remove pull-right icon-clickable"></i>
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-3">
<div class="checkbox">
<label><input type="checkbox">Ondertitels</label>
</div>
</div>
<div class="col-lg-9">
<div class="checkbox">Ondertitel enabled</div>
</div>
</div>
<div class="row">
<div class="col-lg-3">
<div class="checkbox">
<label><input type="checkbox">Vertaling</label>
</div>
</div>
<div class="col-lg-9">
<div class="checkbox">Vertaling enabled</div>
</div>
</div>
<div class="row">
<div class="col-lg-3">
<div class="checkbox">
<label><input type="checkbox">Voice-overs</label>
</div>
</div>
<div class="col-lg-9">
<div class="checkbox text-danger">Voor voice-overs kan geen automatische prijsindicatie gegeven worden.</div>
</div>
</div>
</div>
</div>
</div>
</div>
Well the solution of your problem is to create three separate rows and one row spanning total 12 columns, for which you will use 3 for one checkbox and other for your notification or message.
So each message and check box will be bundled together in container or row class.
Will provide code shortly, if you don't understand what I am trying to say
remove the 10px margin-top from your checkbox class or add it to the othediv. I think this is what cause your offset. :)
Ok so you just need to add margin-top: 10px and margin-bottom: 10px to your div inside the col-lg-9
The answer you are probably searching is just changing the line or font height in your lg9 div
or using only one column, with checkbox and label having a constant width