I have a navigation bar, but i don't know how to vertically align some classes.
I use bootstrap. The navigation bar is fixed position. The navbar is divided into 3 row. The search row is OK, but I can't vertically align the another rows.
Here is the HTML:
<div class="col-sm-10" >
<p>Reményik Tudástár</p>
</div>
</div>
</div>
</div>
<div class="col-sm-4 navbar-search vertical-align">
<div class="container-fluid">
<div class="row vertical-align">
<div class="col-sm-1"></div>
<div class="col-sm-9" style="padding: 0;">
<input type="text" name="search" class="navbar-search-input" placeholder="Keresés">
</div>
<div class="col-sm-1" style="">
<button class="navbar-search-button"><i class="fa fa-search"></i></button>
</div>
<div class="col-sm-1"></div>
</div>
</div>
</div>
<div class="col-sm-4 navbar-login" style="">
<div class="container-fluid">
<div class="row">
<div class="col-sm-10">
<p style="float: right;">Bejelentkezés</p>
</div>
<div class="col-sm-2">
<span class="fa fa-sign-in fa-2x"></span>
</div>
</div>
</div>
</div>
</div>
and here is the CSS:
.navigation-bar {
background-image: url("../img/nav_background.png");
padding: 15px;
box-shadow: 0px 2px 5px #999999;
}
.navbar-search-input {
width: 100%;
border: 0;
border-radius: 3px 0 0 3px;
height: 35px;
padding: 10px;
}
.navbar-search-button {
background-color: #203138;
color: #fff;
margin-right: 100%;
border: 0;
border-radius: 0 3px 3px 0;
height: 35px;
padding-left: 12px;
padding-right: 12px;
}
So, how can I vertically align the logo and the cim class?
Try this:-
display: inline-block;
*display: inline;
vertical-align: middle;
Related
I'm using Bootstrap 4 and want to make a grid view. The problem is that my columns don't have the same width. Also, the height of the columns are not the same as you can see on the borders.
I've read that the columns in Bootstrap 4 should have the same height and width natively, but somehow it seems not to work for me. I'd be glad if someone could help me.
Here's the code of my grid.
.grid-header {
background-color: #002f5a;
color: white;
height: 70px;
font-weight: bold;
font-size: 14pt;
}
.grid-header .col-sm {
border: 1px solid white;
padding: 10px 20px 10px 20px;
}
.grid-row {
border-bottom: 1px solid lightgray;
border-right: 1px solid lightgray;
border-left: 1px solid lightgray;
}
.grid-column-value {
padding: 10px 10px 10px 10px;
border-right: 1px solid lightgray;
}
.grid-filter {
padding: 10px 0 10px 0;
border-bottom: 1px solid lightgray;
border-right: 1px solid lightgray;
border-left: 1px solid lightgray;
}
.grid-filter-column {}
.grid-edit-form {
padding: 10px 0 10px 0;
}
.grid-edit-row {
padding: 0 15px 0 15px;
border-bottom: 1px solid lightgray;
border-right: 1px solid lightgray;
border-left: 1px solid lightgray;
}
.grid-row.selected,
.grid-row:hover {
background-color: #002f5a;
color: white;
}
.grid-action-column {
float: right;
}
.grid-action-column>.btn {
margin-right: 10px;
}
.grid-edit-btn {
background-color: yellow;
}
.grid-edit-btn:hover {
background-color: #ebd234;
}
.grid-delete-btn {
background-color: red;
color: white;
}
.grid-delete-btn:hover {
background-color: darkred;
color: white;
}
.grid-edit-form-buttons {
float: right;
}
.grid-edit-form-buttons>.btn {
margin-left: 10px;
}
<div class="container-fluid">
<div class="grid-header row align-items-center">
<div class="col">Identifier</div>
<div class="col">Der Name</div>
<div class="col">Beschreibung</div>
<div class="col">E-Mail</div>
<div class="col">Link</div>
<div class="col">Erstellt am: </div>
<div class="col"></div>
</div>
<div class="grid-filter row">
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="number" class="form-control" id="inlineFormInputGroup-Id-filter">
</div>
</div>
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="text" class="form-control" id="inlineFormInputGroup-Name-filter">
</div>
</div>
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="" class="form-control" id="inlineFormInputGroup-Description-filter">
</div>
</div>
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="" class="form-control" id="inlineFormInputGroup-EmailAddress-filter">
</div>
</div>
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="" class="form-control" id="inlineFormInputGroup-TestUrl-filter">
</div>
</div>
<div class="col grid-filter-column">
<div class="input-group">
<div class="input-group-prepend"><i class="input-group-text fas fa-filter"></i></div>
<input type="date" class="form-control" id="inlineFormInputGroup-CreatedAt-filter">
</div>
</div>
<div class="col grid-filter-column"></div>
</div>
<div class="grid-row row align-items-center" id="grid-row-1">
<div class="col grid-column-value">1</div>
<div class="col grid-column-value">Hans</div>
<div class="col grid-column-value">This is some cool description</div>
<div class="col grid-column-value">hans.peter#example.net</div>
<div class="col grid-column-value">https://www.google.de/</div>
<div class="col grid-column-value">05.08.2020 13:53:25</div>
<div class="col grid-action-column"><button class="btn grid-edit-btn" onclick="ShowEditRow('http://localhost:5005/Home/CallApi?Id=1', '1');"><i class="fas fa-edit"></i></button><i class="fas fa-trash"></i></div>
</div>
<div class="grid-row row align-items-center" id="grid-row-2">
<div class="col grid-column-value">2</div>
<div class="col grid-column-value">Laura</div>
<div class="col grid-column-value">This is another cool description</div>
<div class="col grid-column-value">laura.g#example.net</div>
<div class="col grid-column-value">https://www.google.de/</div>
<div class="col grid-column-value">05.08.2020 13:53:25</div>
<div class="col grid-action-column"><button class="btn grid-edit-btn" onclick="ShowEditRow('http://localhost:5005/Home/CallApi?Id=2', '2');"><i class="fas fa-edit"></i></button><i class="fas fa-trash"></i></div>
</div>
</div>
Edit: I noticed that this problem is only occuring, if the content of my columns is too long. E.g. if the description is displayed in two lines. I don't want to use "text-truncate", because the content won't be fully shown then.
Insert a w-100 after each row to make them equal.
<div class="row">
<div class="col">col</div>
<div class="col">col</div>
<div class="w-100"></div>
<div class="col">col</div>
<div class="col">col</div>
</div>
After some time I've found an answer.
The problem with the width was that the "emails" were too long and because they were "one word" (no spaces in-between) they could not got broken. So I added the following line to my css:
.grid-column-value {
...
word-break: break-word;
...
}
You can solve this problem with different solutions like the .text-truncate class from Bootstrap. It depends on your needs and preferences.
For the height I got problems because I added the class .align-items-center to my row. To solve this I removed the class from it and added following lines to my css:
.grid-column-value {
...
display: flex;
align-items: center;
}
.grid-action-column {
...
display: flex;
align-items: center;
}
This basically does the same as .align-items-center but directly targets the columns instead of the whole row.
The whole grid now looks like this:
I'm working on an Angular 7 blog application where I'm having some difficulty in adjusting the view of a template made with bootstrap 4. In the main HTML component, I've created two cards in a row, one of it is the blog posts and the other card contains category. The category card is getting fetched from a different component and called using it's selector i.e <app-blog-category></app-blog-category> in the main HTML component. Below are the problems I'm facing in the view. Please look at the image below for reference. Also you can view it from this link ---> https://stackblitz.com/edit/angular-tlbxbr?file=src%2Fapp%2Fapp.component.html
1) The category card is getting rendered beside the last blog document thus leaving a significant amount of space on the top. If I apply style margin-top:negetive-value on the card class as style it is getting resolved but then again the value is differing as the device-width increases or decreases and it goes way above or below than what is needed.
2) the image inside the horizontal card is not taking the full height and width of the card
3) When the device-width is between than 768px-991px, the category card elements i.e the header and list items are breaking maybe due to too much padding around them or being centered.
HTML:
<div class="container">
<div class="row col col-md-12 mx-auto" style="text-align:center; font-size:22px">All Blogs
<br><br><br><br>
</div>
<div class="row" *ngIf="allBlogs.length>0">
<div class="col-md-9 card" *ngFor="let blog of allBlogs">
<div class="row">
<div class="col-md-4">
<a [routerLink]="['/blog', blog.blogId]"><img src="http://localhost:4000/{{blog.imagePath}}" class="card-img-top card-img-size" alt="blog1"></a>
</div>
<div class="col-md-8 px-3">
<div class="card-block px-3">
<h4 class="card-title">{{blog.title}}</h4>
<p class="card-text">{{blog.description}}</p>
<br>
<a [routerLink]="['/blog', blog.blogId]" class="mt-auto btn btn-primary">Read More</a>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-12">
<div class="container"> //note that this part is called from a separate angular component by it's selector <app-blog-category></app-blog-category>
<div class="row">
<div class="col-md-12 card">
<article class="filter-group">
<div class="card-body">
<header class="card-header">
<h6 class="title">Categories</h6>
</header>
<ul class="list-menu">
<li *ngFor="let category of categories" [routerLink]="['/bycategory/', category.categoryId]">{{category.categoryName}}</li>
</ul>
</div>
</article>
</div>
</div>
</div>
</div>
</div>
</div>
CSS:
.card-block {
font-size: 1em;
position: relative;
margin: 0;
padding: 1em;
border: none;
border-top: 1px solid rgba(34, 36, 38, .1);
box-shadow: none;
}
.card {
font-size: 1em;
overflow: hidden;
padding: 5;
border: none;
border-radius: .28571429rem;
box-shadow: 0 1px 3px 0 #d4d4d5, 0 0 0 1px #d4d4d5;
margin-top:20px;
}
.btn {
margin-top: auto;
}
.filter-group {
border-bottom: 1px solid #e4e4e4
}
.card-header {
padding: 0.75rem 1.25rem;
margin-bottom: 0;
background-color: #fff;
border-bottom: 1px solid rgba(0, 0, 0, 0.1)
}
.filter-group .card-header {
border-bottom: 0
}
.icon-control {
margin-top: 6px;
float: right;
font-size: 80%
}
.list-menu {
list-style: none;
margin: 0;
padding-left: 0
}
.list-menu a {
color: #343a40
}
a {
text-decoration: none !important;
background-color: transparent
}
I hope this works for you :
<div class="container">
<div class="row col col-md-12 mx-auto" style="text-align:center; font-size:22px">All Blogs
<br>
<br>
<br>
<br>
</div>
<div class="row">
<div class="col-12 col-md-9 order-2 order-md-1">
<div class="row" *ngIf="allBlogs.length>0">
<div class="col-md-12 card" *ngFor="let blog of allBlogs">
<div class="row">
<div class="col-md-4 p-0">
<a href="#">
<div class="card-img-top card-img-size" style="height: 100%; background-image: url('https://images.pexels.com/photos/1804035/pexels-photo-1804035.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'); background-size: cover; background-position: center;" alt="blog1"></div>
</a>
</div>
<div class="col-md-8 px-3">
<div class="card-block px-3">
<h4 class="card-title">{{blog.title}}</h4>
<p class="card-text">{{blog.description}}</p>
<br>
Read More
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-3 order-1 order-md-2" style="margin-top: 1.1%;">
<app-blog-category></app-blog-category>
</div>
</div>
</div>
What is the way of making div's have equal heights within the row?
it says everywhere that bootstrap4 is flex by default, but it doesn't work for some unknown reason
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="content" >
<div class="sub_title"> HISTORY </div>
<div class="desc"> Sometext </div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-6 col-md-6 col-lg">
<div class="content">
<div class="sub_title">
<div class="number"> 2012 </div>
</div>
<div class="desc"> some other text </div>
</div>
</div>
<div class="col-12 col-sm-6 col-md-6 col-lg ">
<div class="content">
<div class="sub_title">
<div class="number"> 2014 </div>
</div>
<div class="desc"> More text </div>
</div>
</div>
<div class="col-12 col-sm-6 col-md-6 col-lg ">
<div class="content">
<div class="sub_title">
<div class="number"> 2017 </div>
</div>
<div class="desc"> Text here too </div>
</div>
</div>
</div>
the scss
.content {
#extend .effect8;
background: white;
margin: 10px;
padding: 10px 30px 20px;
span {
display: block;
p {
font-weight: bold;
}
}
}
.sub_title {
font-size: 1.5em;
font-weight: 700;
text-transform: uppercase;
display: block;
color: $blue;
margin: 10px auto;
}
this is the scss for the content and the sub_title class
If you want .content to be full height on each .col, the content should have height:100%;. I don't know the CSS def of .effect8.
.content {
background: white;
margin: 10px;
padding: 10px 30px 20px;
height: 100%;
span {
display: block;
p {
font-weight: bold;
}
}
}
https://www.codeply.com/go/B4g6TlSDkA
Actually it depend of browser, e.g In Safari it may not work, and also in Internet Explorer may have unwanted behaviors.
If you're really want equal and avoid cross browser issue try JS solution e.g http://brm.io/jquery-match-height/
I'm having some problems with Bootstrap columns, they are not working the way they are suppose to. In the picture below the 4 profile boxes have to be centered...the same way the 3 columns are centered in the "smart & creative" section. Unfortunately I can't link to a jsfiddle but I have provided code for you to look at below the image, In the code section scroll down for css.
<!-- smart and creative -->
<div class="smart-creative">
<div class="row">
<div class="container">
<div class="title col-xs-12">
<h2>Smart & Creative</h2>
<p>This is why you will use it :)</p>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div class="circles col-md-4 col-sm-4">
<div class="circle1"></div>
<h4>Multi purpose</h4>
<p>Lorem ipsum dolor sit amet,<br /> consectetur adipisicing..</p>
</div>
<div class="circles col-md-4 col-sm-4">
<div class="circle2"></div>
<h4>Flat UI</h4>
<p>Lorem ipsum dolor sit amet,<br /> consectetur adipisicing..</p>
</div>
<div class="circles col-md-4 col-sm-4">
<div class="circle3"></div>
<h4>Creative Design</h4>
<p>Lorem ipsum dolor sit amet,<br /> consectetur adipisicing..</p>
</div>
</div>
</div>
</div>
<!-- Team -->
<div class="team">
<div class="row">
<div class="container">
<div class="team-title col-md-12">
<h2>Talented & Experts</h2>
<p>This is our team</p>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div class="profile-wrapper">
<div class="profiles pic1 col-md-3 col-sm-3">
<div class="pic-holder">
</div>
<div class="desc">
<h5>Mahmoud Baghagho<h5>
<p>Senior UI Designer</p>
</div>
<div class="twitter-button">
<span class="fa fa-twitter">Follow</span>
</div>
</div>
<div class="profiles pic1 col-md-3 col-sm-3">
<div class="pic-holder">
</div>
<div class="desc">
<h5>Mahmoud Baghagho<h5>
<p>Senior UI Designer</p>
</div>
<div class="twitter-button">
<span class="fa fa-twitter">Follow</span>
</div>
</div>
<div class="profiles pic1 col-md-3 col-sm-3">
<div class="pic-holder">
</div>
<div class="desc">
<h5>Mahmoud Baghagho<h5>
<p>Senior UI Designer</p>
</div>
<div class="twitter-button">
<span class="fa fa-twitter">Follow</span>
</div>
</div>
<div class="profiles pic1 col-md-3 col-sm-3">
<div class="pic-holder">
</div>
<div class="desc">
<h5>Mahmoud Baghagho<h5>
<p>Senior UI Designer</p>
</div>
<div class="twitter-button">
<span class="fa fa-twitter">Follow</span>
</div>
</div>
</div>
</div>
</div>
</div>
CSS
// Smart and Creative
.smart-creative{
background-color: $theme1-color;
color: white;
.title{
text-align: center;
padding-top: 10px;
p{
color: $header-color;
}
}
.circles{
padding-top: 25px;
h4,p{
text-align: center;
}
p{
color: $header-color;
}
.css-for-circle{
height: 100px;
width: 100px;
background-color: $header-color;
border-radius: 50px;
background-position: center;
background-repeat: no-repeat;
margin: 0 auto;
}
.circle1{
background-image: url("../imgs/multi.png");
#extend .css-for-circle;
}
.circle2{
background-image: url("../imgs/flat.png");
#extend .css-for-circle;
}
.circle3{
background-image: url("../imgs/creative.png");
#extend .css-for-circle;
}
}
}
// Team
.team{
background-color: $theme2-color;
.team-title{
h2,p{
text-align: center;
}
}
.profile-wrapper{
margin: 0 auto;
width: 95%;
overflow: hidden;
.profiles{
max-width: 230px;
height: 341px;
background-color: white;
border-radius: 5px;
.pic-holder{
max-width: 164px;
height: 164px;
border-radius: 82px;
background-color: $theme2-color;
margin: 0 auto;
position: relative;
top: 25px;
box-shadow: inset 3px 3px 6px -2px #48804B;
-moz-box-shadow: inset 3px 3px 6px -2px #48804B;
-webkit-box-shadow: inset 3px 3px 6px -2px #48804B;
-o-box-shadow: inset 3px 3px 6px -2px #48804B;
background-image: url("http://placehold.it/147x147");
background-repeat: no-repeat;
background-size: 90%;
background-position: center;
}
.desc{
padding: 45px 0 20px 0;
h5,p{
text-align: center;
}
}
.twitter-button{
max-width: 204px;
height: 43px;
background-color: $theme2-color;
margin: 0 auto;
border-radius: 2px;
.fa-twitter{
font-size: 35px;
color: white;
}
}
}
}
}
First of all, rows should be INSIDE containers.
But your real problem is setting a max-width here:
.profiles{max-width: 230px;}
You're not letting the columns expand to their natural width.
This div:
<div class="container">
should be the one holding:
<div class="row">
The correct way, for example:
<div class="container">
<div class="row">
<div class="title col-xs-12">
<h2>Smart & Creative</h2>
<p>This is why you will use it :)</p>
</div>
</div>
</div>
.team .profile-wrapper .profiles {
max-width: 230px;
}
Is making column width smaller then it should be.
I have created code-pan for you please check
http://codepen.io/payalpatel2299/pen/MbRwxo
I am trying to achieve this:
I want the three panels in the gray <div> to overlap with the white jumbotron above them. How can I do this in CSS or with Bootstrap?
HTML:
<div id="home-page">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel">
</div>
</div>
<div class="col-sm-4">
<div class="panel">
</div>
</div>
<div class="col-sm-4">
<div class="panel">
</div>
</div>
</div>
</div>
<div class="container">
<h3>Passionate About Technology?</h3>
<p>We make and effort to learn something everyday</p>
LEARN
</div>
</div>
CSS
#home-page { background: #EFEFEF; }
#home-page .panel { box-shadow: 0px 0px 10px gray; margin: 15px; }
Thanks!
I was able to replicate the pic you had with a few adjustments to your code:
here is the css:
#home-page {
background: #EFEFEF;
}
#home-page .panel {
box-shadow: 0px 0px 10px gray;
margin: 15px;
margin-top:-50px;
height:200px;
}
#jumbo{
height:100px;
}
I also added a div on top to get that effect
<div id="jumbo"></div>
please see my codepen
http://codepen.io/sammyb123/pen/dMJaRw
View below snippet in Full page. If you want the same effect on smaller devices then use col-xs instead.
#home-page .panel {
box-shadow: 0px 0px 10px gray;
height: 250px;
margin-top: -15px;
}
#home-page .jumbo-ctr {
background: #fff;
margin-bottom: 20px;
}
#home-page .panel-ctr {
background: #EFEFEF;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div id="home-page">
<div class="container jumbo-ctr">
<h3>Passionate About Technology?</h3>
<p>We make and effort to learn something everyday</p>
LEARN
</div>
<div class="container-fluid text-center panel-ctr">
<div class="row">
<div class=" col-sm-offset-3 col-sm-2 ">
<div class="panel">
</div>
</div>
<div class="col-sm-2 ">
<div class="panel">
</div>
</div>
<div class="col-sm-2 ">
<div class="panel"></div>
</div>
</div>
</div>
</div>