Unable to achieve a custom grid layout with bootstrap - html

So I have been doing bootstrap for around a month, and so my HTML might be a bit messy. The background of the issue is that my task requires me to create a custom slick carousel to achieve a UI look like the one below:
With my current code this is what i am able to achieve:
Here is my html for what I have achieved so far:
.slider-left {
display: flex;
align-items: center;
p {
font-size: 16px;
border-bottom: 1px solid black;
padding-bottom: 10px;
}
}
.slider-middle {
display: flex;
align-items: center;
word-break: break-word;
h1 {
font-weight: bold;
color: blue;
}
h2 {
text-transform: uppercase;
font-style: italic;
font-size: 16px;
font-weight: normal;
}
}
.v-center {
width: 500px;
height: 1000px;
display: flex;
align-items: center;
}
.slider-image {
width: 100%;
}
.slider-right {
padding: 0;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container-fluid">
<div class="row">
<!-- Left most text -->
<div class="col-lg-1 slider-left text-right">
<div class="container center-align">
<p>Publication</p>
</div>
</div>
<!-- Middle Text -->
<div class="col-md-4 slider-middle center-align">
<div class="container">
<h2>title2</h2>
<h1>title1</h1>
<p>hsdajflaflasdfldsfhlsadfhlsdjfsdljflsjdfsjlfalsjfhjlasfhlsflasfhalfhlasfdsjfdsjlfadsljfhslajfalsjfljsflajflaflajsfdjlafhghurthruhffnfjgjrgbhrturhtadsofadflnvfnilawieoil</p>
<a></a>
</div>
</div>
<!-- Carousel Image -->
<div class="col-md-7 slider-right">
<img class="slider-image" src="<?php bloginfo('template_directory'); ?>/assets/images/image1.jpg" alt="">
</div>
</div>
<div class="row">
<div class="col-5 slider-nav">
<p>navigation</p>
</div>
</div>
</div>
I am required to use bootstrap to achieve any kind of ui design because my supervisor says it helps for the responsiveness of the website. What happens here is that the whole container is moved for a similar container over and over. Please let me know what to do and any explanation would be a great help. Apart from that if anyone knows how to insert custom buttons and custom pagination in that navigation bar can let me know, I would really appreciate it, though I haven't looked much into it.
Cheers :)

Do you mean something like this?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="row">
<div class="col-sm-4" style="background:#f2f2f2;">
Publication
</div>
<div class="col-sm-8">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
<div class="row">
<div class="col-sm-12" style="background:red;">navigation</div>
</div>
</div>
<div class="col-md-6 col-sm-12" style="background:#999;">
Image
</div>
</div>
</div>

Related

How do you put two card classes side by side WITHOUT CSS

Hi Im relatively new to html and need some help
Im coding my profile on a site where CSS is a premium option so I can only use html
I keep running in to the same problem where I can't display two card classes (both of which I use for an info box on my profile) side by side
I'm always able to get the first one exactly where I want it but the second one gets stuck underneath and I want them aligned horizontally
Any pointers?
It always ends up looking something like this
<div class="container m-3 p-3" style="background-color: black; max-width: 950px; border-radius: 5px;">
<div class="container m-3 p-3" style="background: url('BG_IMG'); background-size: cover; #292929; max-width: 885px; border-radius: 5px;"
<div class="p-2 col-sm-4">
<center><img src="IMG_LINK"max-width: 200px; border-radius: 5px"></center>
<div class="card p-2 my-3 text-center">
<h1 class="m-0"><b>NAME</b></h1>
<p><b>SUBTITLE</b></p>
</div>
<div class="col-sm-8">
<div class="card">
<h class="m-3" style="height: auto; text-indent: 20px;"></h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</div>
</div>
<div class="col">
<div class="p-2 col-sm-4">
<div class= "p-2 card">
<h3 class="m-1 text-center">INTERESTS</h3>
<hr class="w-75 my-1" style="background: light; height: 1px;">
<div class="mx-n1 text-center my-auto">
<p class="m-1">CONTENT</p>
<hr class="w-75 my-2" style="background: light; height: 1px;">
<p class="m-1">CONTENT</p>
<hr class="w-75 my-1" style="background: light; height: 1px;">
<p class="m-1">CONENT</p>
<hr class="w-75 my-1" style="background: light; height: 1px">
<p class="m-1">CONTENT</p>
<hr class="w-75 my-1" style="background: light; height: 1px;">
<p class="m-1">CONTENT</p>
</div>
</div>
</div>
</div>
</div>
</div>
A couple of things:
A good thing to do in general is to proof read your code thoroughly, especially if something isn't working. It's annoying to do by hand, that's why I'd recommend using a text editor that does it for you. I personally use VS-code with Prettier for formatting, I'd start there if you don't have your own specific preferences. That's how I directly found a dozen syntax errors. Then if you want, you can just copy-paste it wherever after correcting the errors.
I assume you're using Bootstrap, since you're using their class names. HTML in itself has barely any styling possibilities, except for inline-css (like this: style="background-color: #FFFFFF;"). For layout, checkout their grid system.
Like someone already commented, a site that has css as a premium option probably isn't a site you want to be using. But if you have no other alternative, I made a version of this on codeply (using Bootstrap 5, not sure about which version your site uses, they are similar but not identical). I think this is something like what you're trying to achieve. I made some quite heavy changes on the markup, you'll have to fix the more exact layout yourself, I don't know exactly what you're trying to do, and I don't have the pictures.
Edit: here's the code I put on codeply:
<div class="container" style="background-color: black; max-width: 950px; border-radius: 5px;">
<div class="row m-3 p-3"
style="background: url('BG_IMG'); background-size: cover; background-color:#292929; max-width: 885px; border-radius: 5px;">
<div class="col-12">
<div class="card">
<img src="IMG_LINK" class="card-img-top" style: "max-width: 200px; border-radius: 5px">
<h1 class="card-title text-center">NAME</h1>
<p class="card-text fw-bold text-center">SUBTITLE</p>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="card">
<h3 class="card-title m-3">Title?</h3>
<p class="card-text m-3">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</div>
</div>
<div class="col-4">
<div class="card">
<h3 class="card-title m-3">INTERESTS</h3>
<ul class="list-group">
<li class="list-group-item">CONTENT</li>
<li class="list-group-item">CONTENT</li>
<li class="list-group-item">CONENT</li>
<li class="list-group-item">CONTENT</li>
<li class="list-group-item">CONTENT</li>
</ul>
</div>
</div>
</div>
</div>

Fluid Bootstrap Container Not Aligning Rows Vertically with align-items-* when used with height:100%

I have a basic bootstrap container that has a fluid width. I want to be able to align three rows inside a sidebar to sit at the top, middle and bottom (much like this demo in the bootstrap documentation, but as a sidebar instead of full-width).
From what I can tell from other posts I've read this works with a fixed height, but not a fluid one (i.e. height 100%) - I need the sidebar and the content to both be the full height of the page. Then vertically align within that. However this doesn't seem to be possible. I was wondering if anyone knew a work around for this using bootstrap - it seem like it's something so commonly seen on the web these days that surely there must be a way of achieving it?
I've not added any custom CSS - all I'm attempting this with a classes available in Bootstrap (but I'm happy to create custom classes if required)
<div class="container-fluid h-100">
<div class="row h-100">
<div id="content" class="col-8 h-100">
<p>Some Content</p>
</div>
<div id="sidebar" class="col-4 h-100">
<div id="logo" class="row align-items-start">
<div class="col text-center">
<p>Test Top</p>
</div>
</div>
<div id="helpful-info" class="row align-items-center">
<div class="col text-center">
<p>Test Middle</p>
</div>
</div>
<div id="side-footer" class="row align-items-end">
<div class="col text-center">
<p>Test Bottom</p>
</div>
</div>
</div>
</div>
</div>
I think you’ll need some custom classes for the sidebar section to keep it in place. Beyond that, you just need to setup the sidebar as d-flex flex-column justify-content-between and the divisions should spread out the full height. The sidebar height is set by calculating the viewport height minus the height of the navbar.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<style>
.sidebar {
position: fixed;
top: 0;
bottom: 0;
right: 0;
z-index: 100; /* Behind the navbar */
padding: 48px 0 0; /* Height of navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
}
.sidebar-sticky {
position: relative;
top: 0;
height: calc(100vh - 40px);
padding-top: 0.5rem;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}
#supports ((position: -webkit-sticky) or (position: sticky)) {
.sidebar-sticky {
position: -webkit-sticky;
position: sticky;
}
}
</style>
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand mr-0" href="#">Site name</a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="#">Sign out</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<main class="col-8 mr-auto" style="height: 200vh;">
<h2>Content Area</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
</main>
<nav class="col-4 d-block bg-light sidebar">
<div class="sidebar-sticky d-flex flex-column justify-content-between">
<div id="logo" class="row">
<div class="col text-center">
<h6>Top Section</h6>
</div>
</div>
<div id="helpful-info" class="row">
<div class="col text-center">
<h6>Middle Section</h6>
</div>
</div>
<div id="side-footer" class="row">
<div class="col text-center">
<h6>Bottom Section</h6>
</div>
</div>
</div>
</nav>
</div>
</div>

Putting more content further down my website

So, I am a beginner in web development and i am curretly making a website of a hypothetical travel start up, so i have the home page/landing page up but i don't know how to add content down on my website, basically i want the content when i scroll down, basically like i want a fresh slate where i can put more of my content, i don't know how to explain but like when we visit a website we see a screen with the home page and then we scroll down to reveal more content i want just that, i am linking the home page that i made and also the css, please help me with this.
P.S:- When you run this on html you can even see the text "The Various Tours we do" which was supposed to be down in my website in a new fresh screen rather than on that same page where i have the logo and everything.
Start-Up html code:-
html {
scroll-behavior: smooth;
}
body {
background: url(https://i.pinimg.com/originals/e5/5c/e0/e55ce0b3aa7f8f1c520516dae8f691bf.jpg);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
#content {
text-align: center;
padding-top: 25%;
}
html {
height: 100%
}
#font-face {
font-family: 'Gloss And Bloom Regular';
font-style: normal;
font-weight: normal;
src: local('Gloss And Bloom Regular'), url('Gloss_And_Bloom.woff') format('woff');
}
h1 {
font-family: 'Gloss And Bloom Regular';
font-size: 7em;
color: white;
text-shadow: 0px 4px 3px orange;
}
h3 {
font-family: 'Satisfy', cursive;
color: white
}
hr {
border: 0;
clear: both;
display: block;
width: 400px;
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.fade-in {
animation: fadeIn 3s;
}
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#fade-in {
animation: fadeIn 2s;
}
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.navbar-brand:hover {
background-color: yellow;
color: white;
}
#secondPage {
text-align: center;
height: relative;
float: bottom;
color: black;
}
#heading {
float: top;
margin: 0;
text-align: center;
margin: 0 auto;
}
<title>Wishy Travels</title>
<link href="https://fonts.googleapis.com/css2?family=Satisfy&display=swap" rel="stylesheet">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">Wishy</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" href="#">Sign Up </a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div id="content">
<h1 class='fade-in'> Wishy Travels </h1>
<h3 id="fade-in">Don't listen to what they say, GO SEE.</h3>
<hr>
<button type="button" class="btn btn-light">EXPLORE!</button>
</div>
</div>
</div>
</div>
<div id="secondPage">
<h2>
<center>THE VARIOUS TOURS WE DO</center>
</h2>
</div>
<div id="heading">
The Various Tours we do!
</div>
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous">
</script>
OK, so perhaps my first answer was more relevant. If you want a full screen landing section use viewport height setting (vh) to have it take 100% of the viewport. You could also combine this with with css scroll snapping to ensure when the user scrolls down, the landing content fully leaves view.
https://codepen.io/Ma3147/pen/oNzwJNP
<div class='root'>
<div class='landing-content'>
<h1> Landing Page</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
<div class='rest-content'>
<h2>More Content</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
.root{
scroll-snap-type: y mandatory;
}
.landing-content{
width: 100%;
height: 100vh;
background: red;
}
.rest-content{
scroll-snap-align: start;
background: blue;
color: white;
min-height: 100vh;
}
h2 {
margin-top: 0;
}
https://css-tricks.com/introducing-css-scroll-snap-points/
https://codepen.io/Ma3147/pen/oNzwJNP
There are different ways of handling nav based on the framework you use. However, assuming you are using static HTML files...
Create a separate file for each page and update your <a> tags to link to them. Then place the content for each page in each file
File Structure:
index.html (default landing page)
about.html
services.html
Within your html:
About Page
Our Services

How to remove white gap between two divisions?

I'm using Bootstrap 4 with a custom CSS stylesheet and the structure of my page is as follows:
<header>
<!-- header content (fixed) -->
</header>
<main role="main" class="container-fluid">
<!-- main content -->
</main>
<div id="contact-information">
<!-- contact information (absolute) -->
</div>
<footer class="footer">
<!-- footer content (absolute) -->
</footer>
Now, the issue I am facing is the following, I want <main> to take up all the gap between <header> and <div id="contact-information"> but the actual output is something like this:
<header>
<!-- header content -->
</header>
<main role="main" class="container-fluid">
<!-- main content -->
</main>
<!-- WHITE GAP -->
<div id="contact-information">
<!-- contact information (absolute) -->
</div>
<footer class="footer">
<!-- footer content -->
</footer>
I have looked at similar questions but to no avail, the white gap still remains. I have the feeling it is something to do with my custom CSS. My actual code is (HTML and CSS of each section will follow respectively):
<main> HTML & CSS
<main role="main" class="container-fluid" style="border: 2px solid red;">
<div id="content-container">
<div id="content-container-content">
<h2 class="text-uppercase">About Us</h2>
<hr>
<p id="content-container-sub-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
</div>
</div>
</main>
main {
margin-top: 150px;
padding: 0 !important;
}
#content-container {
position: relative;
height: 432px;
background-color: white;
}
#content-container hr {
visibility: hidden;
}
#content-container-content {
position: absolute;
text-align: center;
width: 90%;
color: #83323e;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#content-container-sub-content {
font-size: 24px;
width: 100%;
color: #a63f4f;
line-height: 40px;
}
<div id="contact-information"> HTML & CSS
<div id="contact-information">
<h3>Company Name</h3>
<p>12 Street, Area, City AB1 2CD, UK</p>
<p>Tel: (01234) 123-456 | Mobile: 01234567891</p>
<p>
View in Map
</p>
<div>
<span style="cursor: pointer;">
<i class="fa fa-twitter fa-2x" aria-hidden="true" style="color: #00aced;"></i>
</span>
<span style="cursor: pointer;">
<i class="fa fa-youtube-play fa-2x" aria-hidden="true" style="color: white;"></i>
</span>
</div>
</div>
#contact-information {
position: absolute;
height: 283px;
width: 100%;
text-align: center;
color: white;
background-color: #a63f4f;
bottom: 60px;
padding: 50px;
}
Visual
Notice the bordered red box doesn't take up all the space responsively.
Live Example
Please click here to view it live.
So, my question is, how do I remove said white gap?
Here's what you should do in order to make that gap vanish on any device:
place #contact-information inside either <header>, <footer> or <main>, based on whether you want it on every page (<header> - above page content, <footer> - below page content) or only on the current page <main>
stop using <main> for styling purposes. It's a container for the content of any and every page, so any styles you add to it will apply on all pages of your website. It is better to treat it as a functional container and only style its children based on your websites' specific needs
If you want <main>'s min-height to fill up the entire page (allow full screen backgrounds, be able to center stuff in the middle of the screen, etc...), give it a min-height of 100vh, no margin, a padding-top equal to <header>s actual height and a padding-bottom equal to <footer>s actual height.
Since both <header> and <footer> have different heights based on device, this should be done dynamically, using JavaScript, on load and resize events of Window object.
Loosely translated into code (I had to make a few assumptions) the above would be:
function setMinHeight() {
$('main').css({
paddingTop: $('header nav').eq(0)[0].clientHeight + 'px',
paddingBottom: $('footer').height() + 'px',
})
}
$(window).on('load resize', setMinHeight);
#contact-information {
text-align: center;
color: white;
background-color: #a63f4f;
bottom: 60px;
padding: 50px;
}
#content-container {
background-color: white;
display: flex;
align-items: center;
justify-content: center;
padding: 50px;
color: #83323e;
border: 2px solid red;
}
#content-container hr {
visibility: hidden;
}
#content-container-sub-content {
font-size: 24px;
color: #a63f4f;
line-height: 40px;
}
main:not(#_) {
min-height: 100vh;
display: flex;
flex-direction: column;
}
main #content-container {
flex-grow: 1;
}
main #contact-information {
flex: 0 0 auto;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
line-height: 60px;
background-color: #83323e;
}
.bg-dark:not(#_) {
background-color: #83323e!important;
}
<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>
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">Fixed navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline mt-2 mt-md-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-default my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
</header>
<main role="main" class="container-fluid">
<div id="content-container" class="row">
<div class="col-12">
<h2 class="text-uppercase">About Us</h2>
<hr>
<p id="content-container-sub-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
</div>
<div id="contact-information" class="row">
<div class="col-12">
<h3>Company Name</h3>
<p>12 Street, Area, City AB1 2CD, UK</p>
<p>Tel: (01234) 123-456 | Mobile: 01234567891</p>
<p>
View in Map
</p>
<div>
<span style="cursor: pointer;">
<i class="fa fa-twitter fa-2x" aria-hidden="true" style="color: #00aced;"></i>
</span>
<span style="cursor: pointer;">
<i class="fa fa-youtube-play fa-2x" aria-hidden="true" style="color: white;"></i>
</span>
</div>
</div>
</div>
</main>
<footer class="footer">
<div class="container">
<span class="text-muted">Place sticky footer content here.</span>
</div>
</footer>
I might be wrong, but from what I found in your example it looks like your team is lacking a CSS guy and you think Bootstrap v4 will help you fill the gap. Chances are it won't. Bootstrap is rock solid if:
you don't stray from given examples (don't need a custom layouts) or...
you understand the CSS behind it, its logic and how to modify it so you don't break anything on various devices.
Besides, v4 is fragile now. Has a few unfixed issues and it's not yet cross-browser/cross-device. If you really don't afford the CSS guy, you're better off using latest v3, which is extremely solid, tested beyond imagination. It's unlikely you'll need something for v3 that hasn't been done yet (which is not the case of v4).
For more details on v3 vs v4 and upgrading from one to the other, I've recently answered this question and the answer stands. For production environments v4 doesn't yet stand a chance against v3, IMHO.

Bootstrap 4 Cards of same height in columns

I'm currently working on Cards from Bootstrap.
Depending on the text title I will get the different height for the cards and would like to have the same height as the tallest one.
I don't mind using JS I actually think is probably the best way to approach the problem.
I have tried using different solutions from the CSS like using flexbox.
The rendered HTML as it is rendered dynamically here's a simple example:
.card {
float: left;
width: 100%;
padding: .75rem;
margin-bottom: 2rem;
border: 0;
box-shadow: 0px 0px 8px 0.3px rgba(0, 0, 0, 1);
}
.card>img {
margin-bottom: .75rem;
display: block;
width: 80%;
height: auto;
margin-left: auto;
margin-right: auto;
}
.card-text {
font-size: 85%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SMITE FR</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/album.css" rel="stylesheet">
<link href="css/ie10-viewport-bug-workaround.min.css" rel="stylesheet">
<script src="https://www.w3schools.com/lib/w3data.js"></script>
<link rel="import" href="navigation.html">
</head>
<body>
<div class="container">
<div class="row">
<div class="card-deck">
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="BeatsX">
<h1 class="card-title">BeatsX</h1>
<div class="text-center">
<p>1188.0000</p>
<p>2017-06-09 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="Nitendo Switch">
<h1 class="card-title">Nitendo Switch</h1>
<div class="text-center">
<p>2899.0000</p>
<p>2017-06-10 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="iPhone 7 128GB (Jet Blakc)">
<h1 class="card-title">iPhone 7 128GB (Jet Blakc)</h1>
<div class="text-center">
<p>6388.0000</p>
<p>2017-06-06 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
The Bootstrap 4 columns already use flexbox so they are the same height. Just use h-100 for height:100% on the cards and they'll fill the columns...
https://codeply.com/go/hKhPuxoovH
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-12">
<div class="card h-100">
<img src="images/dieux/Agni.jpg" alt="BeatsX">
<h1 class="card-title">BeatsX</h1>
<div class="text-center">
<p>1188.0000</p>
<p>2017-06-09 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card h-100">
<img src="images/dieux/Agni.jpg" alt="Nitendo Switch">
<h1 class="card-title">Nitendo Switch</h1>
<div class="text-center">
<p>2899.0000</p>
<p>2017-06-10 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card h-100">
<img src="images/dieux/Agni.jpg" alt="iPhone 7 128GB (Jet Blakc)">
<h1 class="card-title">iPhone 7 128GB (Jet Blakc)</h1>
<div class="text-center">
<p>6388.0000</p>
<p>2017-06-06 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
</div>
</div>
Also there is no reason to float the cards, and the .col-* should be directly in the .row, not .card-deck
Use card-deck for equal size card this below code works for me
<div class="card-deck">
<div class="card mb-2">
<img class="card-img-top img-fluid" src="//placehold.it/500x180" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">Card title</h4>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
<div class="card mb-2">
<img class="card-img-top img-fluid" src="//placehold.it/500x200" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.This card has supporting text below as a natural lead-in to additional content.This card has supporting text below as a natural lead-in to additional content.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
Reference you can find here
As far as I know not doable without either javascript or flexbox (https://osvaldas.info/flexbox-based-responsive-equal-height-blocks-with-javascript-fallback)
Use flex for get it below an example
.main {
display: flex;
}
.child {
flex:1;
border:1px solid tomato;
}
.content {
display: flex;
justify-content: flex-start;
align-items: center;
flex-flow: column nowrap;
}
.content-child{
padding: 5px;
}
<div class="main">
<div class="child">
<div class="content">
<div class="content-child">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="content-child">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
<div class="child"></div>
</div>
Try giving height to card see this fiddle
.card {
float: left;
width: 100%;
padding: .75rem;
height:80vh;
margin-bottom: 2rem;
border: 0;
box-shadow: 0px 0px 8px 0.3px rgba(0,0,0,1);
}
Using Flexbox you got the equal height of the card
.card-deck {
display:flex;
flex-wrap: wrap;
}
.card {
float: left;
width: 100%;
height:100%;
padding: .75rem;
margin-bottom: 2rem;
border: 0;
box-shadow: 0px 0px 8px 0.3px rgba(0,0,0,1);
}
.card > img {
margin-bottom: .75rem;
display: block;
width: 80%;
height: auto;
margin-left: auto;
margin-right: auto;
}
.card-text {
font-size: 85%;
}
#media (max-width:767px){
.card-deck {
display:block;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="card-deck">
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="BeatsX">
<h1 class="card-title">BeatsX</h1>
<div class="text-center">
<p>1188.0000</p>
<p>2017-06-09 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="Nitendo Switch">
<h1 class="card-title">Nitendo Switch</h1>
<div class="text-center">
<p>2899.0000</p>
<p>2017-06-10 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-12">
<div class="card">
<img src="images/dieux/Agni.jpg" alt="iPhone 7 128GB (Jet Blakc)">
<h1 class="card-title">iPhone 7 128GB (Jet Blakc)</h1>
<div class="text-center">
<p>6388.0000</p>
<p>2017-06-06 10:00:00</p>
Voir la Fiche
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-4 d-flex align-items-stretch">
<!--YOUR CARD HERE-->
</div>
</div>
</div>