Vertical Align Center with Bootstrap Modal 4.3 - css

I'm trying to align vertically in the center of my modal in the body and nothing is happening. What is happening? I use version 4.3 of bootstrap.!
<section>
<div id="search-shopkeeper-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="shopkeeperModal" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header border-0 p-0 m-0">
<div class="container-fluid p-2">
<form action="">
<div class="form-row">
<div class="col-12">
<div class="input-group input-group-lg">
<div class="input-group-prepend">
<span id="search-shopkeeper-addon" class="input-group-text bg-transparent border-0"><i class="fas fa-search"></i></span>
</div>
<input type="text" class="form-control rounded-0 border-0 shadow-none" placeholder="Digite o nome do Lojista..." aria-label="Username" aria-describedby="search-shopkeeper-addon">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-body" style="border: 1px red solid">
<!-- #todo -->
<div class="container d-flex align-items-center" style="border: 1px red solid">
<div><h1 class="text-center">SEM RESULTADOS!</h1></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default text-white shadow-none" data-dismiss="modal" style="background-color: #333333 !important">Fechar</button>
</div>
</div>
</div>
</div>
</section>

You want to add the following rules:
.modal-body {
display: flex;
align-items: center;
justify-content: center;
}
This can be seen in the following:
.modal-content {
height: 500px; /* Needed for this example to demonstrate the change */
}
.modal-body {
display: flex;
align-items: center;
justify-content: center;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<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>
<section>
<div id="search-shopkeeper-modal" class="" tabindex="-1" role="dialog" aria-labelledby="shopkeeperModal" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header border-0 p-0 m-0">
<div class="container-fluid p-2">
<form action="">
<div class="form-row">
<div class="col-12">
<div class="input-group input-group-lg">
<div class="input-group-prepend">
<span id="search-shopkeeper-addon" class="input-group-text bg-transparent border-0"><i class="fas fa-search"></i></span>
</div>
<input type="text" class="form-control rounded-0 border-0 shadow-none" placeholder="Digite o nome do Lojista..." aria-label="Username" aria-describedby="search-shopkeeper-addon">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-body" style="border: 1px red solid">
<!-- #todo -->
<div class="container d-flex align-items-center" style="border: 1px red solid">
<div>
<h1 class="text-center">SEM RESULTADOS!</h1>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default text-white shadow-none" data-dismiss="modal" style="background-color: #333333 !important">Fechar</button>
</div>
</div>
</div>
</div>
</section>

Just add "d-flex align-items-center" classes to modal-body
p.s this is an option to use bootstrap but you can do it via css like in comment above
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#search-shopkeeper-modal">
Launch demo modal
</button>
<section>
<div id="search-shopkeeper-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="shopkeeperModal" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header border-0 p-0 m-0">
<div class="container-fluid p-2">
<form action="">
<div class="form-row">
<div class="col-12">
<div class="input-group input-group-lg">
<div class="input-group-prepend">
<span id="search-shopkeeper-addon" class="input-group-text bg-transparent border-0"><i class="fas fa-search"></i></span>
</div>
<input type="text" class="form-control rounded-0 border-0 shadow-none" placeholder="Digite o nome do Lojista..." aria-label="Username" aria-describedby="search-shopkeeper-addon">
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-body d-flex align-items-center" style="border: 1px red solid; height: 500px;">
<!-- #todo -->
<div class="container d-flex align-items-center" style="border: 1px red solid">
<div><h1 class="text-center">SEM RESULTADOS!</h1></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default text-white shadow-none" data-dismiss="modal" style="background-color: #333333 !important">Fechar</button>
</div>
</div>
</div>
</div>
</section>

Related

How to make a button consistent on all size of display?

Image attached is the button from display of two different sizes (24inch and 13inch), button on 24inch display appears normal whereas add to cart button on 13inch display is broken.13inch display button 24 inch display button
<div class="row my-5" id="3">
<span id="lblArtworkId" style="display: none;">3</span>
<div class="col-2">
<div class="d-flex justify-content-center">
<a href="./">
<img src="upload/artworks/Artwork3.jpg" alt="" class="card-img-top" style="max-height: 8rem;">
</a>
</div>
</div>
<div class="col-6">
<div class="h-100 d-flex flex-column justify-content-between">
<span>
<a href="./" class="text-decoration-none text-muted fs-4">
Construction in Red, Blue & Yellow Drawing
</a>
</span>
<hr>
<p class="m-0">Artist: Karin White</p>
</div>
</div>
<div class="col-2">
<div class="h-100 d-flex align-items-center justify-content-center">
<span class="fw-bold">$ 1120.00</span>
</div>
</div>
<div class="col-2">
<div class="h-100 d-flex align-items-center justify-content-between">
<button id="btnRemove" class="btn btn-outline-danger">Remove</button>
<button id="btnCart" class="btn btn-primary">Add to Cart</button>
</div>
</div>
</div>
Welcome to stackoverflow.
You can use cols with a breakpoint prefix to adjust the layout. (e.g. col-xxl-2 col-3). Read Bootstrap Breakpoints and Grid options for more information. Also, since Bootstrap is sensitive to pixels, it is much better to consider pixels instead of inches.
Example:
<div class="container">
<div class="row my-5" id="3">
<span id="lblArtworkId" style="display: none;">3</span>
<div class="col-xxl-2 col-3">
<div class="d-flex justify-content-center">
<a href="./">
<img src="upload/artworks/Artwork3.jpg" alt="" class="card-img-top" style="max-height: 8rem;">
</a>
</div>
</div>
<div class="col-xxl-6 col-9">
<div class="h-100 d-flex flex-column justify-content-between">
<span>
<a href="./" class="text-decoration-none text-muted fs-4">
Construction in Red, Blue & Yellow Drawing
</a>
</span>
<hr>
<p class="m-0">Artist: Karin White</p>
</div>
</div>
<div class="col-xxl-2 col-4">
<div class="h-100 d-flex align-items-center justify-content-center">
<span class="fw-bold">$ 1120.00</span>
</div>
</div>
<div class="col-xxl-2 col-8">
<div class="h-100 d-flex align-items-center justify-content-between">
<button id="btnRemove" class="btn btn-outline-danger w-50 mx-1">Remove</button>
<button id="btnCart" class="btn btn-primary w-50 mx-1">Add to Cart</button>
</div>
</div>
</div>
</div>
Edit
Don't forget to include the required meta tags:
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

Add button inside an Input Tag

I have created a login form. I want to show a text/button that says "FORGOT?" on the right side of the password field.
For reference you guys can open this site and click on login : https://www.adda247.com/
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<br><br><br>
<div class="col-md-5 col-sm-5 col-xs-5" ></div>
<div class="col-md-2 col-sm-2 col-xs-2" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div><br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">Forgot?</p>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<p align="center" style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
</form>
Hope you can help me !
If I understood the question correct this is the solution?
You just have to manipulate the display arguments in your css
<div class="container">
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<br><br><br>
<div class="col-md-5 col-sm-5 col-xs-5" ></div>
<div class="col-md-2 col-sm-2 col-xs-2"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div><br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px; width: 90%; display: inline-block" placeholder="Password">
<a class="form-control-feedback" style="display:inline-block; width:5%" href="#">Forgot?</a>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<p style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
Add padding on password field padding-right: 80px
Set the password field container to position: relative then set "FORGOT?" hint to position: absolute and right: 1em (so that it's fixed to its righ) then design it as you want using CSS or bootstrap classes (you'll still need a bit of pure CSS, I used the same padding and height as the input in this example).
To avoid overlapping issues, I set a white background on the "FORGOT?" hint so any overlapping text is not shown (you could add it through the bg-white class as well) but you could set a padding-right on your <input> that equals the width of the "FORGOT?" hint.
.form-group.has-feedback {
position: relative;
}
.form-control-feedback {
position: absolute;
display: inline-block;
top: 1px;
right: 1em;
background: #fff;
bottom: 0;
margin: 0;
height: calc(1.5em + .75rem + 2px);
padding: .375rem .75rem;
border-radius: 3px;
}
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<div class="col-md-5 col-sm-5 col-xs-5 mb-4" ></div>
<div class="col-md-2 col-sm-2 col-xs-2 mb-4" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5 mb-4"></div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback mb-4">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">FORGOT?</p>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<p align="center" style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
</form>
I suggest you to not use <br> elements to create spaces between your items, bootstrap has classes for that (such has .mb-4 for example).
I have used the position relative and absolute method to move the button inside the input box.
Remove br and use mt- and mb- values to get spacing in bootstrap 4.
.form-group.has-feedback {
position: relative;
}
.form-control-feedback {
position: absolute;
top: 0;
right: 15px;
padding: 6px 8px 9px 8px;
display: inline-block;
}
.form-group.has-feedback .form-control {
padding: 0 70px 0 0;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<div class="col-md-5 col-sm-5 col-xs-5"></div>
<div class="col-md-2 col-sm-2 col-xs-2" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div>
<div class="col-md-12 col-sm-12 col-xs-12 my-3">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">Forgot?</p>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<p align="center" style="font-size:16px">Don't Have an Account?
<span>SIgn Up</span>
</p>
</div>
</div>
</form>

Making bootstrap modal work in a framework7 web app

I am having trouble with including bootstrap modal onto a framework7 app.
I suspect that framework7 is suppressing boostrap modal from appearing.
This is my fiddle.
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><i class="icon icon-back"></i><span>Back</span></div>
<div class="">
<span id="project_name" class="center sliding">Title</span>
</div>
<div class="right">
<a id="create_task" style="">Create</a>
</div>
</div>
</div>
<div class="pages navbar-through ">
<div data-page="about" class="page no-toolbar page-on-center">
<div class="page-content">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="content-block">
<p>This project is made possible because of these open-source projects & beta testers.</p>
</div>
<div class="content-block-title">Open Source</div>
<div class="content-block">
<div class="content-block-inner">
Framework7
</div>
<div class="content-block-inner">
Vuejs
</div>
<div class="content-block-inner">
Ruby on Rails
</div>
<div class="content-block-inner">
Font Awesome
</div>
<div class="content-block-inner">
Axios
</div>
<div class="content-block-inner">
Kaminari
</div>
<div class="content-block-inner">
Puma
</div>
</div>
<div class="content-block-title">Thanks to these beta testers</div>
<div class="content-block">
<div class="content-block-inner">
<li>John Doe</li>
<li>Nathan</li>
<li>Sharon days</li>
</div>
</div>
<div class="content-block-title">Logo</div>
<div class="content-block">
<div class="content-block-inner">
<b>Lau Jun Wen</b>
</div>
</div>
<!-- Trigger the modal with a button -->
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Can someone give me some pointers on what is wrong? There is no error message. Appreciate any feedback/advice to resolve this.
I have made several changes to correct the problems:
Removed the modal.min.js. This was the problem causing the modal to open and close again.
Re-ordered the bootstrap/framework7 CSS + JS to put framework7 after the bootstrap (so that the framework7 overrides bootstrap when necessary).
Put the myModal div at the end of the code so that its z-index does not get blocked by a parent div's less-high z-index.
Add some custom CSS to make the modal show up correctly. This is necessary due to using two frameworks.
Here is the final code:
#myModal.modal {
width: auto;
margin-left: 0;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-transform: translate3d(0,0,0) scale(1);
transform: translate3d(0,0,0) scale(1);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/framework7/1.6.4/js/framework7.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/framework7/1.6.4/css/framework7.ios.min.css" rel="stylesheet"/>
<div class="navbar">
<div class="navbar-inner">
<div class="left sliding"><i class="icon icon-back"></i><span>Back</span></div>
<div class="">
<span id="project_name" class="center sliding">Title</span>
</div>
<div class="right">
<a id="create_task" style="">Create</a>
</div>
</div>
</div>
<div class="pages navbar-through ">
<div data-page="about" class="page no-toolbar page-on-center">
<div class="page-content">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="content-block">
<p>This project is made possible because of these open-source projects & beta testers.</p>
</div>
<div class="content-block-title">Open Source</div>
<div class="content-block">
<div class="content-block-inner">
Framework7
</div>
<div class="content-block-inner">
Vuejs
</div>
<div class="content-block-inner">
Ruby on Rails
</div>
<div class="content-block-inner">
Font Awesome
</div>
<div class="content-block-inner">
Axios
</div>
<div class="content-block-inner">
Kaminari
</div>
<div class="content-block-inner">
Puma
</div>
</div>
<div class="content-block-title">Thanks to these beta testers</div>
<div class="content-block">
<div class="content-block-inner">
<li>John Doe</li>
<li>Nathan</li>
<li>Sharon days</li>
</div>
</div>
<div class="content-block-title">Logo</div>
<div class="content-block">
<div class="content-block-inner">
<b>Lau Jun Wen</b>
</div>
</div>
</div>
</div>
</div>
<!-- Trigger the modal with a button -->
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Updated fiddle here

position HTML5 ARIA popup under main div

i am new to ARIA tags. Kindly excuse if i am stupid.
What i want is a custom drop down to be visible when i click the down arrow.
The problem is the popup comes write below the icon as shown in this pic.
CSS
.vertical-align {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
}
.bkcolor {
background-color: #009cf6;
width: 305px;
/*#008bdd*/
}
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="app">
<div id="container">
<div class="row" style="background:#009DF8;" id="namebardiv">
<div class="col-xs-10 col-md-5">
<div class="row">
<div class="col-xs-3 col-md-3">
</div>
<div class="col-xs-6 col-md-6">
<div class="row" style="color: white;font-size: 11px;">
</div>
</div>
<div class="col-xs-3 col-md-3">
</div>
</div>
<div class="row vertical-align">
<div class="col-xs-3 col-md-3">
<i class="icon-arrow-left21 pull-right" style="color:white;font-size:30px;"></i>
</div>
<div class="col-xs-7 col-md-7">
<div class="row vertical-align">
<div class="col-xs-7 col-md-7" style="color: white; font-size: 35px;display: inline-block;">
Benarsi Das
</div>
<div class="col-xs-1 col-md-1 dropdrown">
<div class="dropdown-toggle" style="color: white; font-size: 35px;display: inline-block;" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</div>
<ul class="dropdown-menu bkcolor" aria-labelledby="dropdownMenu1" style="min-height: 165px;">
something
</ul>
</div>
<div class="col-xs-4 col-md-4">
<span style="color: white;font-size: 23px;padding-top: 10px;"></span>
</div>
</div>
</div>
<div class="col-xs-2 col-md-2">
</div>
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
<div class="col-xs-10 col-md-5 vertical-align">
<div class="row">
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
</div>
</body>
</html>
But I need it like this
I know I can achieve it with this code
.vertical-align {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
}
.bkcolor {
background-color: #009cf6;
width: 305px;
/*#008bdd*/
}
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="app">
<div id="container">
<div class="row" style="background:#009DF8;" id="namebardiv">
<div class="col-xs-10 col-md-5">
<div class="row">
<div class="col-xs-3 col-md-3">
</div>
<div class="col-xs-6 col-md-6">
<div class="row" style="color: white;font-size: 11px;">
</div>
</div>
<div class="col-xs-3 col-md-3">
</div>
</div>
<div class="row vertical-align">
<div class="col-xs-3 col-md-3">
<i class="icon-arrow-left21 pull-right" style="color:white;font-size:30px;"></i>
</div>
<div class="col-xs-7 col-md-7">
<div class="row dropdown" id="dropdownrow">
<div class="dropdown-toggle" style="color: white; font-size: 35px; width:210px;display: inline-block;" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<div id="dropdownlabel" style="color: white; font-size: 35px;display: inline-block;width:180px;font-family:'Roboto-Regular',san-serif">
Benarsi Das
</div>
<span class="caret"></span>
</div>
<ul class="dropdown-menu bkcolor" aria-labelledby="dropdownMenu1" style="min-height: 165px;">
something
</ul>
</div>
</div>
<div class="col-xs-2 col-md-2">
</div>
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
<div class="col-xs-10 col-md-5 vertical-align">
<div class="row">
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
</div>
</body>
</html>
But this makes the dropdown(popup) visible even the text is clicked. I want it only to be visible only when the dropdown icon is clicked.
Any help would be greatly appreciated.
In your stylesheet, add the declaration
transform: translate(-60px, 26px);
to the style rules for .bkcolor.
N.B. You can alter the x-translate (-60px) and the y-translate (26px) to achieve the exact positioning that you want.
Working Example:
.vertical-align {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
}
.bkcolor {
background-color: #009cf6;
width: 305px;
/*#008bdd*/
transform: translate(-60px, 26px);
}
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="app">
<div id="container">
<div class="row" style="background:#009DF8;" id="namebardiv">
<div class="col-xs-10 col-md-5">
<div class="row">
<div class="col-xs-3 col-md-3">
</div>
<div class="col-xs-6 col-md-6">
<div class="row" style="color: white;font-size: 11px;">
</div>
</div>
<div class="col-xs-3 col-md-3">
</div>
</div>
<div class="row vertical-align">
<div class="col-xs-3 col-md-3">
<i class="icon-arrow-left21 pull-right" style="color:white;font-size:30px;"></i>
</div>
<div class="col-xs-7 col-md-7">
<div class="row vertical-align">
<div class="col-xs-7 col-md-7" style="color: white; font-size: 35px;display: inline-block;">
Benarsi Das
</div>
<div class="col-xs-1 col-md-1 dropdrown">
<div class="dropdown-toggle" style="color: white; font-size: 35px;display: inline-block;" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</div>
<ul class="dropdown-menu bkcolor" aria-labelledby="dropdownMenu1" style="min-height: 165px;">
something
</ul>
</div>
<div class="col-xs-4 col-md-4">
<span style="color: white;font-size: 23px;padding-top: 10px;"></span>
</div>
</div>
</div>
<div class="col-xs-2 col-md-2">
</div>
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
<div class="col-xs-10 col-md-5 vertical-align">
<div class="row">
</div>
</div>
<div class="col-xs-1 col-md-1"></div>
</div>
</body>
</html>

Bootstrap Modals - Modal id's different yet only one appears correctly

I'm having trouble with these modals in bootstrap. I have set the id for both differently yet only the first one appears when the "more" button is pressed. The second button does not show the required modal.
<div id="tf-team" class="text-center">
<div class="overlay" id="team1">
<div class="container">
<div class="section-title center">
<h4>Something</h4>
<h2 class="white">The Team</h2>
<img src="img/daag.png" alt="">
</div>
</div>
<div id="team" class="owl-carousel owl-theme row">
<!-- Team One -->
<div class="item">
<div class="thumbnail">
<img src="img/team/01.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>CEO name</h3>
<p class="blue">CEO</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal1">More</button>
</div>
</div>
</div>
<!-- Team Two -->
<div class="item">
<div class="thumbnail">
<img src="img/team/03.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Marketing Executive name</h3>
<p class="blue">Marketing Executive</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal2">More</button>
</div>
</div>
</div>
These are the modals that should be appearing. The first modal appears as normal but the second doesn't even though the ID's are different.
<!-- Modal One-->
<div id="myModal1" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">text</h4>
</div>
<div class="modal-body">
<p><strong>text</strong></p>
<p>text</p>
<p><strong>text</strong></p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- Modal Two-->
<div id="myModal2" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Dana</h4>
</div>
<div class="modal-body">
<p><strong>text</strong></p>
<p>text
</p>
<p><strong>text Tick</strong></p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Does anyone have any ideas as to why this is happening?
You are just missing two closing </div> tags on the first modal.
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<div id="tf-team" class="text-center">
<div class="overlay" id="team1">
<div class="container">
<div class="section-title center">
<h4>Something</h4>
<h2 class="white">The Team</h2>
<img src="img/daag.png" alt="">
</div>
</div>
<div id="team" class="owl-carousel owl-theme row">
<!-- Team One -->
<div class="item">
<div class="thumbnail">
<img src="img/team/01.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Jim Rae</h3>
<p class="blue">CEO</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal1">More</button>
</div>
</div>
</div>
<!-- Team Two -->
<div class="item">
<div class="thumbnail">
<img src="img/team/03.jpg" alt="..." class="img-circle team-img">
<div class="caption">
<h3>Dana Apatachioae</h3>
<p class="blue">Marketing Executive</p>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal2">More</button>
</div>
</div>
</div>
<!-- Modal One-->
<div id="myModal1" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">text</h4>
</div>
<div class="modal-body">
<p><strong>text</strong>
</p>
<p>text</p>
<p><strong>text</strong>
</p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- You are missing these two ending </div> tags. -->
</div>
</div>
<!-- Modal Two-->
<div id="myModal2" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Dana</h4>
</div>
<div class="modal-body">
<p><strong>text</strong>
</p>
<p>text
</p>
<p><strong>text Tick</strong>
</p>
<p>text
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

Resources