How can I add a footer to a flex-container? - css

I'm trying to add a bootstrap footer to my project. It works well on the big screen but when you start scaling down the screen, the footer is placed in the middle of the page instead of the bottom. What am I doing wrong?
#media only screen and (max-width: 1150px) {
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
}
<div class="bigcontainer">
<div class="box1">
<h3>RENOVATIONS</h3>
<p><br /></p>
<p>
At <em>Razca Designs</em>, we specialize in interior renovation design, from small kitchen updates to complete home remodels. We have a wealth of experience and expertise in creating personalized spaces that reflect our clients’ unique styles and
personalities.
</p>
<p><br /></p>
<p>
Our team will work closely with you every step of the way to bring your project to completion. We take the time to fully understand the specific challenges and pain points of each client in their current home, and use this information to design a tailor-made
solution that addresses each individual need. Our approach is to provide you with a beautiful and functional home that you’ll love spending time in
</p>
<p><br /></p>
<b><em>Our passion is creating personalized, welcoming spaces that are tailored to you and your family. With Razca Designs, you can trust us to transform your home into a space that exceeds your expectations</em></b>
</div>
<div class="box2">
<img src="textimages/reno10.jpg" alt="" class="img-fluid" />
</div>
<div class="box3">
<img src="textimages/renov-3.jpg" alt="" class="img-fluid" />
<img src="textimages/ren101.jpg" alt="" class="img-fluid" />
</div>
<div class="box4">
<h3>RENOVATIONS</h3>
<p><br /></p>
<ul class="ab">
<li>
Reviewing permits or managing permit applications if necessary
</li>
<li>reate the neceesary drawings, including:</li>
<p>Existing and demolition plans</p>
<p>Proposed plans</p>
<p>Construction plans</p>
<p>Electrical plans.</p>
<p>Furniture Plans</p>
<li>
Providing materials and finishes according to your design palette
</li>
<li>Design of custom furniture</li>
<li>Requesting quotes; ordering and coordinating deliveries</li>
<li>Dealing contractors and craftsmen</li>
<li>Dealing with suppliers and overseeing quality control</li>
<li>
Final design steps, like finishes and confirming forniture and cabinetery.
</li>
</ul>
</div>
</div>
<!-- Footer -->
<footer class="text-center text-lg-start bg-white text-muted">
<!-- Section: Social media -->
<section class="d-flex justify-content-center justify-content-lg-between p-4 border-bottom">
<!-- Left -->
<div class="me-5 d-none d-lg-block">
<span>Get connected with us on social networks:</span>
</div>
<!-- Left -->
<!-- Right -->
<div>
<a href="" class="me-4 link-secondary">
<i class="fab fa-facebook-f"></i>
</a>
<a href="" class="me-4 link-secondary">
<i class="fab fa-twitter"></i>
</a>
<a href="" class="me-4 link-secondary">
<i class="fab fa-google"></i>
</a>
<a href="" class="me-4 link-secondary">
<i class="fab fa-instagram"></i>
</a>
<a href="" class="me-4 link-secondary">
<i class="fab fa-linkedin"></i>
</a>
<a href="" class="me-4 link-secondary">
<i class="fab fa-github"></i>
</a>
</div>
<!-- Right -->
</section>
<!-- Section: Social media -->
<!-- Section: Links -->
<section class="">
<div class="container text-center text-md-start mt-5">
<!-- Grid row -->
<div class="row mt-3">
<!-- Grid column -->
<div class="col-md-3 col-lg-4 col-xl-3 mx-auto mb-4">
<!-- Content -->
<h6 class="text-uppercase fw-bold mb-4">
<i class="fas fa-gem me-3 text-secondary"></i>Company name
</h6>
<p>
Here you can use rows and columns to organize your footer content. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
<!-- Links -->
<h6 class="text-uppercase fw-bold mb-4">Products</h6>
<p>
Angular
</p>
<p>
React
</p>
<p>
Vue
</p>
<p>
Laravel
</p>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-3 col-lg-2 col-xl-2 mx-auto mb-4">
<!-- Links -->
<h6 class="text-uppercase fw-bold mb-4">Useful links</h6>
<p>
Pricing
</p>
<p>
Settings
</p>
<p>
Orders
</p>
<p>
Help
</p>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4">
<!-- Links -->
<h6 class="text-uppercase fw-bold mb-4">Contact</h6>
<p>
<i class="fas fa-home me-3 text-secondary"></i> New York, NY 10012, US
</p>
<p>
<i class="fas fa-envelope me-3 text-secondary"></i> info#example.com
</p>
<p>
<i class="fas fa-phone me-3 text-secondary"></i> + 01 234 567 88
</p>
<p>
<i class="fas fa-print me-3 text-secondary"></i> + 01 234 567 89
</p>
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</div>
</section>
<!-- Section: Links -->
<!-- Copyright -->
<div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.025)">
© 2021 Copyright:
<a class="text-reset fw-bold" href="https://mdbootstrap.com/">MDBootstrap.com</a>
</div>
<!-- Copyright -->
</footer>
<!-- Footer -->
<!-- Carousel wrapper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
Here is my screen shot

I was able to figure out what I was doing wrong
.bigcontainer {
display: flex;
flex-wrap: wrap;
width: 98vw;
align-items: center;
margin: 20px;
font-family: "sans";
margin-left: 150px;
}
.bigcontainer::after {
width: 98vw;
position: absolute;
z-index: -1;
right: 0;
}
.bigcontainer > div {
width: 50%;
height: 50%;
padding: 18px;
}
.box1 {
margin-bottom: 20px;
}
.box3 {
display: flex;
gap: 10px;
}
.box3 img {
width: 45%;
height: 30rem;
}
.box2 img {
width: 70%;
}
#media screen and (max-width: 908px) {
.bigcontainer > div {
width: 100%;
height: max-content;
flex: 0 0 100%;
}
.bigcontainer {
display: flex;
flex-wrap: wrap;
width: 98vw;
align-items: center;
margin: 20px;
font-family: "sans";
padding: 15;
margin-left: 0;
margin-top: 150px;
}
.text-container {
width: auto;
margin-bottom: auto;
}
.testing {
width: auto;
margin: auto;
}
.box2 {
order: 4;
}
.box2 img {
width: 100%;
height: 100%;
}
.box3 {
flex-wrap: wrap;
}
.box3 img {
width: 100%;
}
.box2 img {
width: 100%;
}
.bigcontainer::after {
display: none;
}
}
.box1 {
font-family: "sans";
line-height: 150%;
}
.box4 {
font-family: "sans";
line-height: 150%;
}
h3 {
font-size: 18px;
font-weight: bolder;
}
.box4 h3 {
padding-left: 15px;
}
.imge-4 {
width: 100px;
}
.dropdown:hover .dropdown-menu {
display: block;
margin-top: 0; /* remove the gap so it doesn't close */
}
.text-container {
width: 600px;
margin-bottom: 90px;
}
.testing {
width: 600px;
margin-left: 20px;
}
#media screen and (max-width: 568px) {
.bigcontainer > div {
width: 100%;
height: max-content;
flex: 0 0 100%;
}
.bigcontainer {
display: flex;
flex-wrap: wrap;
width: 98vw;
align-items: center;
margin: 20px;
font-family: "sans";
padding: 15;
margin-left: 0;
margin-top: 150px;
}
.testing {
width: auto;
margin: auto;
}
.text-container {
width: auto;
margin-bottom: auto;
}
.box2 {
order: 4;
}
.box2 img {
width: 100%;
height: 100%;
}
.box3 {
flex-wrap: wrap;
}
.box3 img {
width: 100%;
}
.box2 img {
width: 100%;
}
.bigcontainer::after {
display: none;
}
}

Related

Make the images same size in grid card

I made some card using grid and flexbox for the content. The image is not the same size each cards. I use the display grid for the wrapper and flexbox for the card content. I tried to use flex-grow and flex-basis in the trackcard_header class, but nothing works. I attach the sample of my code result below, please take a look to the snippet too.
Here is the screenshot:
And this is my snippet:
.createpl_card_wrapper {
margin-top: 2rem;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-column-gap: 2rem;
grid-row-gap: 1rem;
}
.trackcard {
display: flex;
flex-direction: column;
justify-content: space-between;
border-radius: 1rem;
background-color: rgba(0, 0, 0, 0.2);
width: 100%;
padding: 1rem 0.5rem;
position: relative;
}
.trackcard_header {
width: 80%;
margin: auto;
}
.trackcard_header img {
max-width: 100%;
height: auto;
border-radius: 1rem;
}
.trackcard_body {
padding: 1rem;
flex-grow: 1;
text-align: center;
}
.trackcard_body h2 {
font-size: 1.5rem;
}
.trackcard_body h4 {
font-size: 1rem;
}
.trackcard_footer {
width: 80%;
margin: auto;
}
.trackcard_btn {
width: 100%;
padding: 0.25rem 0;
background-color: #1db954;
border-radius: 0.5rem;
border: 1px solid #1db954;
color: #fff;
}
.trackcard_btn:hover {
background-color: #18a349;
}
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<link rel="stylesheet" href="./src/styles.css" />
<body>
<div class="createpl_card_wrapper">
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b2738c0defcb336a0296eb7d704a"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>GANADARA (Feat. IU)</h2>
<h4>
Jay Park - GANADARA
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b273c63be04ae902b1da7a54d247"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>eight(Prod.&Feat. SUGA of BTS)</h2>
<h4>
IU - eight
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b27315cf3110f19687b1a24943d1"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>Good day</h2>
<h4>
IU - REAL
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b2734ed058b71650a6ca2c04adff"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>Celebrity</h2>
<h4>
IU - IU 5th Album 'LILAC'
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b273a1d785640d9421ec17ea8fe6"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>BBIBBI</h2>
<h4>
IU - BBIBBI
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
</div>
<script src="src/index.js"></script>
</body>
</html>
I want to make the images is in the same size, both vertically and horizontally. Could anyone give me solution? Thank you in advance.
You need to give the divs an actual size, in your code, they only have % values and no parent static value to take the %age out of. I've given the .trackcard class a width of 30vw. In order to make the images square, you also need to give it a height that's not dependent on other height values, but have the same value as the width, so I gave it a placeholder of 24vw which is 80% of the .trackcard. You need to use object-fit: contain to not stretch. You can refer to the docs I linked and use the one you prefer.
.createpl_card_wrapper {
margin-top: 2rem;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-column-gap: 2rem;
grid-row-gap: 1rem;
}
.trackcard {
display: flex;
flex-direction: column;
justify-content: space-between;
border-radius: 1rem;
background-color: rgba(0, 0, 0, 0.2);
width: 30vw;
padding: 1rem 0.5rem;
position: relative;
}
.trackcard_header {
width: 80%;
margin: auto;
}
.trackcard_header img {
width: 24vw;
height: 24vw;
object-fit: contain;
border-radius: 1rem;
}
.trackcard_body {
padding: 1rem;
flex-grow: 1;
text-align: center;
}
.trackcard_body h2 {
font-size: 1.5rem;
}
.trackcard_body h4 {
font-size: 1rem;
}
.trackcard_footer {
width: 80%;
margin: auto;
}
.trackcard_btn {
width: 100%;
padding: 0.25rem 0;
background-color: #1db954;
border-radius: 0.5rem;
border: 1px solid #1db954;
color: #fff;
}
.trackcard_btn:hover {
background-color: #18a349;
}
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<link rel="stylesheet" href="./src/styles.css" />
<body>
<div class="createpl_card_wrapper">
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b2738c0defcb336a0296eb7d704a"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>GANADARA (Feat. IU)</h2>
<h4>
Jay Park - GANADARA
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b273c63be04ae902b1da7a54d247"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>eight(Prod.&Feat. SUGA of BTS)</h2>
<h4>
IU - eight
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b27315cf3110f19687b1a24943d1"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>Good day</h2>
<h4>
IU - REAL
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b2734ed058b71650a6ca2c04adff"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>Celebrity</h2>
<h4>
IU - IU 5th Album 'LILAC'
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img
src="https://i.scdn.co/image/ab67616d0000b273a1d785640d9421ec17ea8fe6"
alt="name"
/>
</div>
<div class="trackcard_body">
<h2>BBIBBI</h2>
<h4>
IU - BBIBBI
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
</div>
<script src="src/index.js"></script>
</body>
</html>
That can be achieved with some JavaScript.
First you select all the elements with querySelectorAll. You then make an array of its height with offsetHeight. Math.max returns the largest sum of the input parameter.
In a for loop, you can set the elements minHeight with Math.max. It keeps looping until it finds the length and then applies the styling. Keep in mind this will apply the height of the largest image as min-height on all of your images.
And while we're at it, I did the same thing for the h2-elements, so they're aligned equally in all the cards. I separated the JS so it is easier to read and understand. The only gotcha is you have to reload the page if you drag the screen size, as the min-height will be a bit off.
As for CSS I used grid-template-columns: repeat(5, minmax(200px, 1fr)); instead. This way there will always be 5 columns that are atleast 200px wide, so they have an equal size. If you want a responsive effect, just edit the 5 out with auto-fit, this way they will wrap on smaller screens.
Like so:
grid-template-columns: repeat(5, minmax(auto-fit, 1fr));
If you want to change the width or height of your images, I suggest using max-width and max-height for a responsive effect. If you don't change the width, they will look a bit stretched.
You can apply object-fit: cover; on the images also, this way the image won't be stretched, but a bit of the image will be cut off instead.
I hope this helps you!
Snippet below will not work properly, check Codepen: https://codepen.io/sigurdmazanti/pen/qBpLGXe
let img = document.querySelectorAll(".trackcard_header img");
let text = document.querySelectorAll(".trackcard_body h2");
// Image
let imgLength = Array.from(img).map(e => e.offsetHeight);
let maxLength = Math.max(...imgLength);
// H2
let textLength = Array.from(text).map(e => e.offsetHeight);
let maxTextLength = Math.max(...textLength);
// Image for loop
for (let i = 0; i < img.length; i++) {
img[i].style.minHeight = maxLength + "px";
}
// H2 for loop
for (let i = 0; i < text.length; i++) {
text[i].style.minHeight = maxTextLength + "px";
}
.createpl_card_wrapper {
margin-top: 2rem;
display: grid;
/*grid-template-columns: repeat(5, 1fr); */
grid-template-columns: repeat(5, minmax(200px, 1fr));
grid-column-gap: 2rem;
grid-row-gap: 1rem;
}
.trackcard {
display: flex;
flex-direction: column;
justify-content: space-between;
border-radius: 1rem;
background-color: rgba(0, 0, 0, 0.2);
width: 100%;
padding: 1rem 0.5rem;
position: relative;
}
.trackcard_header {
width: 80%;
margin: auto;
}
.trackcard_header img {
max-width: 100%;
height: auto;
border-radius: 1rem;
/* Consider this */
object-fit: cover;
}
.trackcard_body {
padding: 1rem;
flex-grow: 1;
text-align: center;
}
.trackcard_body h2 {
font-size: 1.5rem;
}
.trackcard_body h4 {
font-size: 1rem;
margin-top: auto;
}
.trackcard_footer {
width: 80%;
margin: auto;
}
.trackcard_btn {
width: 100%;
padding: 0.25rem 0;
background-color: #1db954;
border-radius: 0.5rem;
border: 1px solid #1db954;
color: #fff;
}
.trackcard_btn:hover {
background-color: #18a349;
}
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<link rel="stylesheet" href="./src/styles.css" />
<body>
<div class="createpl_card_wrapper">
<div class="trackcard">
<div class="trackcard_header">
<img src="https://i.scdn.co/image/ab67616d0000b2738c0defcb336a0296eb7d704a" alt="name" />
</div>
<div class="trackcard_body">
<h2>GANADARA (Feat. IU)</h2>
<h4>
Jay Park - GANADARA
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img src="https://i.scdn.co/image/ab67616d0000b273c63be04ae902b1da7a54d247" alt="name" />
</div>
<div class="trackcard_body">
<h2>eight(Prod.&Feat. SUGA of BTS)</h2>
<h4>
IU - eight
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img src="https://i.scdn.co/image/ab67616d0000b27315cf3110f19687b1a24943d1" alt="name" />
</div>
<div class="trackcard_body">
<h2>Good day</h2>
<h4>
IU - REAL
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img src="https://i.scdn.co/image/ab67616d0000b2734ed058b71650a6ca2c04adff" alt="name" />
</div>
<div class="trackcard_body">
<h2>Celebrity</h2>
<h4>
IU - IU 5th Album 'LILAC'
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
<div class="trackcard">
<div class="trackcard_header">
<img src="https://i.scdn.co/image/ab67616d0000b273a1d785640d9421ec17ea8fe6" alt="name" />
</div>
<div class="trackcard_body">
<h2>BBIBBI</h2>
<h4>
IU - BBIBBI
</h4>
</div>
<div class="trackcard_footer">
<button type="button" class="trackcard_btn">
Select
</button>
</div>
</div>
</div>
<script src="src/index.js"></script>
</body>
</html>

Vertical scroll not working inside ul tag overlay in Angular app

I am trying to scroll through a list of items, but scroll is working only for some of the items, not all. After a certain item, the scroll stops and does not go the last item.
Here is the Stackblitz link.
https://angular-cym8q4.stackblitz.io/
This is for a chatlist overlay which contains list of profiles. Please refer to the following screenshot:
In the above screenshot, I am not able to scroll through all the profiles. Scroll if happening for only some of the profiles, it is not going to the very end of the list.
Here is my code:
app.component.html
<div class="container-fluid">
<div class="row">
<div class="col-3 d-none d-lg-block col-offset-5 red coloverlay bg-custom">
<app-chatlist></app-chatlist>
</div>
</div>
</div>
app.component.css
.coloverlay {
background-color: rgba(233, 33, 33, 0.4);
margin: 0;
padding: 0;
position: fixed;
top: 150px;
z-index: 1;
bottom: 0;
right: 0;
margin: 0;
}
.bg-custom {
background: #2c3e50;
}
chatlist.component.html
<div class="container-fluid p-0">
<div class="row m-0 ">
<div class="col p-0">
<div class="d-flex flex-row chatlistbox ">
<div class="m-2">
Chat
</div>
<div class="ml-auto mt-1 pr-2">
<i class="fa fa-window-minimize " aria-hidden="true"></i>
</div>
<div class="m-2">
<i class="fa fa-cog" aria-hidden="true"></i>
</div>
</div>
<div class="customList">
<ul class="list-group overflow-auto" id="contact-list">
<app-chatlist-item class="list-group-item p-0 border-0" *ngFor="let el of elList" [element]="el">
</app-chatlist-item>
</ul>
</div>
</div>
</div>
</div>
chatlist.component.css
.overflow-auto {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}
.customList {
height: 93%;
}
.chatlistbox {
background: aquamarine;
height: 2%;
}
chatlist-item.component.html
<div class="d-flex flex-row bg-custom item">
<div class="p-2">
<img src="{{element.imagePath}}" alt="" />
</div>
<div class="p-2">
<div class="d-flex flex-column flex-wrap name">
<h6 class="m-0">
{{element.firstName}} {{element.lastName}}
</h6>
<span class="details">
{{element.details}}
</span>
</div>
</div>
</div>
chatlist-item.component.css
img {
width: 80px;
height: 80px;
border-radius: 40px;
padding: 3px;
float: left;
cursor: pointer;
}
.bg-custom {
background: #2c3e50;
}
* {
color: #e3dcdc;
}
.item:hover {
background: #32465a;
}
I am not sure what is the problem. Any help would be highly apprecitated.
The issue is that the container is taller than the page, so the scroll bar goes off the page.
To fix it, you need to set the height on some of the elements, like so:
.container-fluid.p-0,
.row.m-0,
.col.p-0 {
height: 100%;
}
Finally, you will need to change the height of customList. I would recommend using calc instead of a fixed percentage, which may not be what you want.
.customList {
height: calc(100% - 15px);
}
Here is a fork of the stackblitz with the CSS fixed:
https://stackblitz.com/edit/angular-7c7dmk?file=src/app/chatlist/chatlist.component.css

How do I make all of these images the same dimension but still Bootstrap responsive?

I have code that displays images and a countdown below the images. How do I make all the images the same dimensions but also let Bootstrap be responsive? At the same time, also making sure the countdown box below stays with the dimensions of the images? Thanks :)
/* Books */
#books_div {
position: absolute;
left: 50%;
top: 25%;
transform: translatex(-50%);
}
#books_text {
position: absolute;
left: 50%;
top: 15%;
transform: translatex(-50%);
}
.description_one, .description_two, .description_three {
color: #9B0103;
max-width: 100%;
text-align: center;
border: 1px solid #9B0103;
border-top: none;
font-weight: bold;
}
.description_one a {
text-decoration: none !important;
}
#book_column a {
text-decoration: none !important;
}
/* End of Books */
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Books -->
<h2 id='books_text'> We Giveaway Free Books </h2>
<div class="row" id='books_div'>
<!-- First Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1472913234l/29563587.jpg' alt='' id='book_cover_one' token_id='4ce0e43b806457bbc21881748d6a50d2'>
<div class='description_one'>
5:05:12
</div> </a>
</div>
<!-- End of First Book -->
<!-- Second Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1388211242l/69571.jpg' alt='' id='book_cover_two' token_id='bb8673cb597c7fc7cba7bc13d9f08a4b'>
<div class='description_two'>
6:32:14
</div> </a>
</div>
<!-- End of Second Book -->
<!-- Third Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1342493368l/3636.jpg' alt='' id='book_cover_three' token_id='25ea7f6c20f1f185841ed88c9a9d2f2c'>
<div class='description_three'>
7:12:04
</div> </a>
</div>
<!-- End of Third Book -->
Solution 1
You can add below at the bottom of your css
img[id^="book_cover"]{
width:500px;
height:500px;
}
The above will target all img elements with id that starts with book_cover, example book_cover_one, book_cover_two, etc
See snippet below
/* Books */
#books_div {
position: absolute;
left: 50%;
top: 25%;
transform: translatex(-50%);
}
#books_text {
position: absolute;
left: 50%;
top: 15%;
transform: translatex(-50%);
}
.description_one, .description_two, .description_three {
color: #9B0103;
max-width: 100%;
text-align: center;
border: 1px solid #9B0103;
border-top: none;
font-weight: bold;
}
.description_one a {
text-decoration: none !important;
}
#book_column a {
text-decoration: none !important;
}
img[id^="book_cover"]{
width:500px;
height:500px;
}
/* End of Books */
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Books -->
<h2 id='books_text'> We Giveaway Free Books </h2>
<div class="row" id='books_div'>
<!-- First Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1472913234l/29563587.jpg' alt='' id='book_cover_one' token_id='4ce0e43b806457bbc21881748d6a50d2'>
<div class='description_one'>
5:05:12
</div> </a>
</div>
<!-- End of First Book -->
<!-- Second Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1388211242l/69571.jpg' alt='' id='book_cover_two' token_id='bb8673cb597c7fc7cba7bc13d9f08a4b'>
<div class='description_two'>
6:32:14
</div> </a>
</div>
<!-- End of Second Book -->
<!-- Third Book -->
<div class='col-lg-3 col-sm-6 portfolio-item' id='book_column'>
<a href='#'>
<img class='img-responsive' src='https://images.gr-assets.com/books/1342493368l/3636.jpg' alt='' id='book_cover_three' token_id='25ea7f6c20f1f185841ed88c9a9d2f2c'>
<div class='description_three'>
7:12:04
</div> </a>
</div>
<!-- End of Third Book -->
Solution 2
Instead of solution 1, this seems much more simpler
.img-responsive{
width:500px;
height:500px;
}
Try add one more class to yor CSS:
.thumb img {
width: 100%;
height: 300px;
}
This should fix your problem.

Align and center various elements in a Bootstrap 'row'

Been having difficulty trying to center vertically a Font Awesome icon, a 2 text line div, and 2 more icons in the same Bootstrap row div. I managed to fake the needed outcome but after hours trying out numerous CSS properties I'd love to hear what the best solutions was.
So the items I need to position vertically centered so those stay that way regardless of the containing element size are the 'fa fa-building-o fa-4x' icon, the 2 lines of text to its right ("X5 Retail Group" and "Company address and contacts"), both are of different font size (which I attempted to achieve with <h5> and <h3> tags), and the 2 icons to the right.
It was not required to make the sections of a certain height. The line-height property contains a number convenient to me at the moment.
The code was designed for Firefox 39.
Here's a Plunkr link to my html: https://plnkr.co/edit/0BVnHFowRD53KOVoy1KU?p=preview
Below is the .html of the page.
body {
padding-top: 20px;
}
section#top1 {
line-height: 40px;
}
section#top2 {
line-height: 80px;
}
.monitoring {
background-color: #E8E8E8;
}
.monitoringh4 {
display: inline;
}
.h4buttonlike:hover {
cursor: pointer;
font-weight: bold;
}
section#top3 {
line-height: 60px;
}
section#top4 {
line-height: 80px;
}
.container {
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 5px;
}
.container .col-md-12 {
background: #e6e6e6;
border-radius: 4px;
}
.container .logo {
display: inline;
margin: auto 0 auto 0;
width: 80px;
}
.container h4 {
font-size: 1.0em;
display: inline;
margin-left: 5px;
text-align: center;
}
section#top1 .container ul {
display: table;
margin: auto 0;
float: right;
}
section#top1 .container ul li {
display: table-cell;
padding-right: 15px;
}
.settings i {
vertical-align: middle;
}
.container i {
margin-right: 5px;
}
.dropdown {
display: inline;
margin-left: 5px;
margin-top: 3px;
}
.myclass {
text-align: right;
}
section#top4 .brands {
position: absolute;
top: 50%;
display: inline-block;
/* margin-left: 20px; */
transform: translate(5%, -55%);
}
.exp {
height: 56px;
width: 44px;
display: inline-block;
text-align: center;
vertical-align: middle;
}
.my-icons {
position: absolute;
top: 50%;
right: 15px;
transform: translate(-60%, -50%);
display: inline-block;
}
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<section id='top1'>
<div class='container'>
<div class='row'>
<div class='col-md-12'>
<img class='logo' src='http://www.toennies.com/uploads/pics/fTRACE-Logo_02.png'>
<h4>Company name</h4>
<ul>
<li>Total items: 100</li>
<li style='color: #009900;'>Oline: 82</li>
<li style='color: #787878;'>Offline: 16</li>
<li style='color: #FF0000;'>Damaged: 6</li>
</ul>
</div>
<div class='clearfix'></div>
</div>
</div>
</section>
<section id='top2'>
<div class='container'>
<div class='row'>
<div class='col-md-9 monitoring'>
<div class='monitoringh4'>
<h4>Monitoring</h4>
</div>
<div class="dropdown">
<h4 class="dropdown-toggle h4buttonlike" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Reports
<span class="caret"></span>
</h4>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>Report 1
</li>
<li>Report 2
</li>
<li>Report 3
</li>
</ul>
</div>
<div class="dropdown">
<h4 class="dropdown-toggle h4buttonlike" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Tune
<span class="caret"></span>
</h4>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>Tune 1
</li>
<li>Tune 2
</li>
<li>Tune 3
</li>
</ul>
</div>
</div>
<div class='col-md-3 monitoring'>
<div class="dropdown">
<h4 class="dropdown-toggle h4buttonlike" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
John Doe (Admin)
<span class="caret"></span>
</h4>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>Jane Doe
</li>
<li>Jack Doe
</li>
<li>Jimmy Doe
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section id='top3'>
<div class='container'>
<div class='row'>
<div class='col-md-12 settings'>
<h4><i class="fa fa-desktop fa-2x"></i>Tuneup > Company profile > X5 Retail Group</h4>
</div>
</div>
</div>
</section>
<section id='top4'>
<div class='container'>
<div class='row'>
<div class='col-md-12'>
<div class='exp'><i class="fa fa-building-o fa-4x"></i>
</div>
<div class='brands'>
<h3>X5 Retail Group</h3>
<h5>Company address and contacts</h5>
</div>
<div class='my-icons'>
<h5><i class="fa fa-pencil-square-o"> Edit</h5>
</i>
<h5><i class="fa fa-print"></i>Print</h5>
</div>
</div>
</div>
</div>
</section>
Thank you.

Flex-box justify-content not working whilst align-items does

I'm trying to move around text with justify-content with flex box and whilst align-items works to move the content vertically, justify-content doesn't work to move the content horizontally.
I know I can use text-align, however I don't like how it moves all the text to the far right including the sub-title text, which I want to start at the same place as the title does - I believe this would be what justify-content would do.
CodePen: http://codepen.io/gutterboy/pen/yYxmLP
HTML:
<div id="main-slider" class="carousel">
<div class="container">
<div class="row">
<div class="col-sm-offset-1 col-sm-10">
<div class="carousel-inner" role="listbox">
<div class="item item1 active">
<img src="http://dreamatico.com/data_images/car/car-1.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
<div class="item item2">
<img src="http://dreamatico.com/data_images/car/car-8.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#main-slider" data-slide-to="0" class="active"></li>
<li data-target="#main-slider" data-slide-to="1"></li>
</ol>
CSS:
.item {
position: relative;
.details {
position: absolute;
top: 0;
text-align: center;
width: 100%;
height: 100%;
padding: 25px;
color: #fff;
z-index: 2;
align-items: flex-end;
justify-content: center;
h2 {
margin-top: 0;
}
}
&.item2 {
.details {
align-items: flex-start;
justify-content: flex-start;
}
}
}
.fix-flex {
width: 100%;
}
.flex-row {
display: flex;
flex-flow: row nowrap;
}
There is more CSS related to the code, but it's related to bootstrap.
The issue you are having is due to your fix-flex class. It has a width of 100%. It is being centered with justify-content:center but since the element is the same size of its container it is not visually obvious that it is working. Check out my fork of your codepen.
Fork of your codepen
This should be removed
.fix-flex {width:100%;}
After reading #paulie_D's comments I realised it had to do with the fix-flex class which had a style of width: 100%; set and was wrapped around the content I was trying to justify and hence it really couldn't move it.
This was also pointed out by Adrian Eufracio's answer; however removing the div altogether would cause the issue I was trying to prevent; so I had to leave the div in the code but just remove the width: 100%; from the styles and I can now justify the content and the text doesn't wrap.
CodePen: http://codepen.io/gutterboy/pen/jbeOrP
HTML:
<div id="main-slider" class="carousel">
<div class="container">
<div class="row">
<div class="col-sm-offset-1 col-sm-10">
<div class="carousel-inner" role="listbox">
<div class="item item1 active">
<img src="http://dreamatico.com/data_images/car/car-1.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
<div class="item item2">
<img src="http://dreamatico.com/data_images/car/car-8.jpg" class="img-responsive" />
<div class="details flex-row">
<div class="fix-flex">
<h2>I'm a header title</h2>
<p class="sub-title">
I'm a little sub-title
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ol class="carousel-indicators">
<li data-target="#main-slider" data-slide-to="0" class="active"></li>
<li data-target="#main-slider" data-slide-to="1"></li>
</ol>
CSS:
.item {
position: relative;
.details {
position: absolute;
top: 0;
text-align: center;
width: 100%;
height: 100%;
padding: 25px;
color: #fff;
z-index: 2;
align-items: flex-end;
justify-content: center;
h2 {
margin-top: 0;
}
}
&.item2 {
.details {
align-items: flex-start;
justify-content: flex-start;
}
}
}
.flex-row {
display: flex;
flex-flow: row nowrap;
}

Resources