Las Line's alignment is not proper - html

selected-works div's last lines's alignmet is not proper. It's text-align property has value of justify but there is a problem in last line. It is like left based not justify. Other lines have no any problem. How can I solve this problem?
* {
margin: 0;
padding: 0;
}
body {
background: #000;
text-align: center;
color: rgb(231, 231, 231);
}
#wrapper {
width: 60%;
margin: 0 auto;
}
#hello {
padding: 50px;
border-bottom: 3px double rgb(185, 185, 185);
}
#avatar {
border-radius: 50%;
width: 130px;
height: auto;
margin-bottom: 15px;
}
#hello-header {
margin-bottom: 15px;
font-size: 45px;
}
#header-p {
font-size: 36px;
}
.link {
text-decoration: none;
color: rgb(241, 225, 1);
}
.link:hover {
color: gray;
transition: 0.2s;
}
#selected-works {
width: 100%;
margin: 50px 0;
padding-bottom: 50px;
text-align: justify;
border-bottom: 1px solid gray;
}
#sw-header {
margin-bottom: 35px;
text-align: center;
}
.work {
width: 32%;
display: inline-block;
text-align: left;
}
.work img {
width: 100%;
height: auto;
}
.work img:hover {
opacity: .5;
transition: opacity .3s linear;
}
<div id="wrapper">
<div id="hello">
<img id="avatar" src="https://jonchretien.com/img/avatar.jpg">
<h2 id="hello-header">Hello</h2>
<p id="header-p">
My name is Jon Chretien. I’m a <a class="link" href="https://en.wikipedia.org/wiki/New_York_City">NYC</a> based front end engineer currently working on web apps for artists at <a class="link" href="https://www.spotify.com/">Spotify</a>. I previously
built editorial & marketing projects at <a class="link" href="https://www.nytimes.com/">The New York Times</a>.
</p>
</div>
<div id="selected-works">
<h1 id="sw-header">Selected Works</h1>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
<div class="work">
<a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists"><img src="https://jonchretien.com/img/work_s4a.jpg"></a>
<h2><a class="link" href="https://artists.spotify.com/blog/fan-insights-is-now-spotify-for-artists">Spotify for Artists</a></h2>
<p>Fan insights for artists & managers to discover more about their audience.</p>
</div>
</div>
</div>
selected-works div's last lines's alignmet is not proper. It's text-align property has value of justify but there is a problem in last line. It is like left based not justify. Other lines have no any problem. How can I solve this problem?

By default,
text-align: justify;
justifies all lines, except last one. If you also want the last line justified, you have to use text-align-last:
text-align-last: justify;
Note: This property is part of CSS text module 3 and current browser support sits at 77.98%.
To add support for it in legacy browsers, one would need to use a polyfill.

Related

cant seem to move image

I am trying to move my image a bit up to align with the x axis but i have tried position relative and padding but it doesnt seem to move but when i change width it works. I am making the change in .luxxreno img but it is not working does anyone know why and how i will adjust its position? I just want to move it up a bit because it is not aligned in my div/
CSS
.container {
padding: 2.5em 1.25em 0;
margin: 0 auto;
border-bottom: 0.125em solid rgb(105, 105, 105);
border-width: 100%;
padding-bottom: 1.25em;
}
h1 {
margin: 0;
text-align: center;
font-size: 3.125em;
overflow: hidden;
line-height: 1;
color: white;
}
h1 span {
display: block;
animation: reveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) 0.5s;
}
.meet-the-owner h3 {
text-align: center;
color: rgb(255, 215, 0);
font-size: 1.5625em;
font-family: "BatmanForeverAlternate";
}
.meet-the-owner-top h3 {
text-align: center;
color: rgb(255, 215, 0);
font-size: 1.5625em;
font-family: "BatmanForeverAlternate";
padding: 2.5em;
}
.luxxreno {
text-align: center;
width: 100%;
padding-bottom: 2.5em;
}
.luxxreno img {
border-radius: 50%;
top: 3em;
}
.meet-the-owner {
padding: 3.125em;
border-top: 0.125em solid rgb(105, 105, 105);
}
.q-l {
color: white;
display: inline-block;
text-align: left;
font-size: 1em;
padding-left: 10%;
padding-top: 2em;
}
.questions p {
padding: 0.625em;
padding-left: 0;
font-size: 1.4em;
}
.luxx-name {
font-family: "BatmanForeverAlternate";
left: 0.2em;
font-size: 3.125em;
top: 1.9em;
padding-bottom: 10px;
}
.owner {
font-family: "BatmanForeverAlternate";
color: red;
padding-bottom: 25px;
}
.luxx-socials {
padding-top: 30px;
}
HTML
<section class="player-bios">
<div class="container">
<h1>
<span>Players</span>
</h1>
</div>
<div class="meet-the-owner-top">
<h3>Meet the Owner</h3>
</div>
<div class="luxxreno">
<img src="images/luxx.jpg">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">LUXX RENO</h2>
<h2 class="owner">OWNER</h2>
<p>Real Name: <b>Cory George</b></p>
<p>Online Name: <b>Luxx Reno</b></p>
<p>First Game Played as a Kid: <b>Duck Hunter/Super Nintendo</b></p>
<p>Game I'm Best At: <b>Fortnite</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br><b>Mimicry, so I'd be able to mimic and super power I see.</b></p>
<p>Favourite Artist of All Time: <b>Billy Raffoul</b></p>
<p>Hidden Talents: <b>Won lots of medals for swimming!</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/channel/UCPqsHNuWTAbckHg4R3WAJIg" target=”_blank”><li>487 # YouTube</li></a>
<a href="https://www.instagram.com/luxxreno/?hl=en" target=”_blank”><li>2.6k # Instagram</li></a>
<a href="https://www.twitch.tv/luxxreno" target=”_blank”><li>3k # Twitch</li></a><br>
<a href="https://twitter.com/LuxxReno" target=”_blank”><li>2.5k # Twitter</li></a>
<a href="https://www.tiktok.com/#luxxxreno?lang=en&is_copy_url=1&is_from_webapp=v1" target=”_blank”><li>657k # TikTok</li></a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>Content Creator</h3>
</div>
<div class="luxxreno">
<img src="images/abz-c.png">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">ABZZINO</h2>
<h2 class="owner">Content Creator</h2>
<p>Real Name: <b>Abdullah Khan</b></p>
<p>Online Name: <b>Abzzino</b></p>
<p>First Game Played as a Kid: <b>Call Of Duty</b></p>
<p>Game I'm Best At: <b>Call Of Duty (all of them)</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br> <b>Flying</b></p>
<p>Hidden Talents: <b>They're hidden for a reason.</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/c/Abzzino/featured" target=”_blank”><li>360 # YouTube</li></a>
<a href="https://www.instagram.com/_abzzino_/" target=”_blank”><li>193 # Instagram</li></a>
<a href="https://www.twitch.tv/abzzinok" target=”_blank”><li>2.6k # Twitch</li></a><br>
<a href="https://twitter.com/_Abzzino_" target=”_blank”><li>142 # Twitter</li></a>
<a href="https://www.tiktok.com/#abzzinoyt?lang=en" target=”_blank”><li>23.6k # TikTok</li></a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>COMPETITIVE PLAYER</h3>
</div>
<div class="luxxreno">
<img src="images/kyran-c.png">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">KEEZO</h2>
<h2 class="owner">COMPETITIVE PLAYER</h2>
<p>Real Name: <b>Kyran Garden</b></p>
<p>Online Name: <b>KEEZO</b></p>
<p>First Game Played as a Kid: <b>Call Of Duty 3</b></p>
<p>Game I'm Best At: <b>Warzone</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br> <b>Flying</b></p>
<p>Favourite Artist of All Time: <b>Drake</b></p>
<p>Hidden Talents: <b>I'm good at football.</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.twitch.tv/LKeezo" target=”_blank”><li>400 # Twitch</li></a>
<a href="https://twitter.com/KEEZZ0" target=”_blank”><li>1.2k # Twitter</li></a>
<a href="https://www.tiktok.com/#kkeezo?lang=en" target=”_blank”><li>1.1k # TikTok</li></a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>Content Manager</h3>
</div>
<div class="luxxreno">
<img src="images/brad-c.png">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">SPODERBRAD</h2>
<h2 class="owner">Content Manager</h2>
<p>Real Name: <b>Brad</b></p>
<p>Online Name: <b>SpoderBrad</b></p>
<p>First Game Played as a Kid: <b>Metal Gear Solid</b></p>
<p>Game I'm Best At: <b>Splitgate</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br><b>Honestly don’t want a super power just wanna <br> be Iron Man.</b></p>
<p>Favourite Artist of All Time: <br> <b>Drake or Eminem can’t decide</b></p>
<p>Hidden Talents: <b>Best Free Kick Taker on Twitch.</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/channel/UCnqgXWWmmg1F3L919lzT6aQ" target=”_blank”><li>353 # YouTube</li></a>
<a href="https://www.instagram.com/spoderbrad/?hl=en-gb" target=”_blank”><li>115 # Instagram</li></a>
<a href="https://www.twitch.tv/SpoderBrad" target=”_blank”><li>2.1k # Twitch</li></a><br>
<a href="https://twitter.com/SpoderBrad" target=”_blank”><li>392 # Twitter</li></a>
<a href="https://www.tiktok.com/#spoderbrad?lang=en" target=”_blank”><li>60k # TikTok</li></a>
</ul>
</div>
</div>
</div>
</section>
I am not absolutely certain that this is what you are talking about, but in this CSS
.luxxreno img {
border-radius: 50%;
top: 3em;
}
the top setting will be ignored because there is no position set on the element. And when you do set it, make sure whatever ancestor element you want it positioned relative to also has a position set, otherwise CSS will hunt up the DOM til it finds such an ancestor.

section is not following div css rules

I have made multiple sections using a div called .luxxreno and all of them look the same which they should do, however there is one which is slightly miss aligned and isn't aligning, can someone tell me how I can align it and what is causing the issue, the section that is not aligning is called 'kyran, competitive player'.
HTML and CSS
/*PLAYER PAGE*/
.container {
padding: 2.5em 1.25em 0;
margin: 0 auto;
border-bottom: 0.125em solid rgb(105, 105, 105);
border-width: 100%;
padding-bottom: 1.25em;
}
h1 {
margin: 0;
text-align: center;
font-size: 3.125em;
overflow: hidden;
line-height: 1;
color: white;
}
h1 span {
display: block;
animation: reveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) 0.5s;
}
.meet-the-owner h3 {
text-align: center;
color: rgb(255, 215, 0);
font-size: 1.5625em;
font-family: "BatmanForeverAlternate";
}
.meet-the-owner-top h3 {
text-align: center;
color: rgb(255, 215, 0);
font-size: 1.5625em;
font-family: "BatmanForeverAlternate";
padding: 2.5em;
}
.luxxreno {
text-align: center;
width: 100%;
padding-bottom: 1em;
position: relative;
}
.luxxreno img {
border-radius: 50%;
width: 550px;
position: inherit;
bottom: 4em;
}
.meet-the-owner {
padding: 3.125em;
border-top: 0.125em solid rgb(105, 105, 105);
}
.q-l {
color: white;
display: inline-block;
text-align: left;
font-size: 0.9em;
padding-left: 10%;
padding-top: 2em;
}
.questions p {
padding: 0.625em;
padding-left: 0;
font-size: 1.4em;
}
.luxxreno h2 {
font-family: "BatmanForeverAlternate";
left: 0.2em;
font-size: 3em;
top: 1.9em;
padding-bottom: 10px;
}
.status {
font-family: "BatmanForeverAlternate";
left: 0.2em;
font-size: 3em;
top: 1.9em;
padding-bottom: 10px;
}
.owner {
font-family: "BatmanForeverAlternate";
color: red;
padding-bottom: 25px;
font-size: 3em;
}
.luxx-socials {
padding-top: 30px;
}
<section class="player-bios">
<div class="container">
<h1>
<span>Players</span>
</h1>
</div>
<div class="meet-the-owner-top">
<h3>Meet the Owner</h3>
</div>
<div class="luxxreno">
<img src="images/luxx.jpg">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">LUXX RENO</h2>
<h2 class="owner">OWNER</h2>
<p>Real Name: <b>Cory George</b></p>
<p>Online Name: <b>Luxx Reno</b></p>
<p>First Game Played as a Kid: <b>Duck Hunter/Super Nintendo</b></p>
<p>Game I'm Best At: <b>Fortnite</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br><b>Mimicry, so I'd be able to mimic and super power I see.</b></p>
<p>Favourite Artist of All Time: <b>Billy Raffoul</b></p>
<p>Hidden Talents: <b>Won lots of medals for swimming!</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/channel/UCPqsHNuWTAbckHg4R3WAJIg" target=”_blank”>
<li>487 # YouTube</li>
</a>
<a href="https://www.instagram.com/luxxreno/?hl=en" target=”_blank”>
<li>2.6k # Instagram</li>
</a>
<a href="https://www.twitch.tv/luxxreno" target=”_blank”>
<li>3k # Twitch</li>
</a><br>
<a href="https://twitter.com/LuxxReno" target=”_blank”>
<li>2.5k # Twitter</li>
</a>
<a href="https://www.tiktok.com/#luxxxreno?lang=en&is_copy_url=1&is_from_webapp=v1" target=”_blank”>
<li>657k # TikTok</li>
</a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>Content Creator</h3>
</div>
<div class="luxxreno">
<img src="images/avg-c.png">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">AVERAGEANT</h2>
<h2 class="owner">Content Creator</h2>
<p>Real Name: <b>Anthony Bryne</b></p>
<p>Online Name: <b>Average Ant</b></p>
<p>First Game Played as a Kid: <b>Modern Warfare 2</b></p>
<p>Game I'm Best At: <b>Call Of Duty Warzone</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br> <b>Mind Reader</b></p>
<p>Favourite Artist of All Time: <b>Lil Tjay</b></p>
<p>Hidden Talents: <b>Best Swimmer on Twitch</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/c/Abzzino/featured" target=”_blank”>
<li>360 # YouTube</li>
</a>
<a href="https://www.instagram.com/_abzzino_/" target=”_blank”>
<li>193 # Instagram</li>
</a>
<a href="https://www.twitch.tv/abzzinok" target=”_blank”>
<li>2.6k # Twitch</li>
</a><br>
<a href="https://twitter.com/_Abzzino_" target=”_blank”>
<li>142 # Twitter</li>
</a>
<a href="https://www.tiktok.com/#abzzinoyt?lang=en" target=”_blank”>
<li>23.6k # TikTok</li>
</a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>COMPETITIVE PLAYER</h3>
</div>
<div class="luxxreno">
<img src="images/kyran-c.png">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">KEEZO</h2>
<h2 class="owner">COMPETITIVE PLAYER</h2>
<p>Real Name: <b>Kyran Garden</b></p>
<p>Online Name: <b>KEEZO</b></p>
<p>First Game Played as a Kid: <b>Call Of Duty 3</b></p>
<p>Game I'm Best At: <b>Warzone</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br> <b>Flying</b></p>
<p>Favourite Artist of All Time: <b>Drake</b></p>
<p>Hidden Talents: <b>I'm good at football.</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.twitch.tv/LKeezo" target=”_blank”>
<li>400 # Twitch</li>
</a>
<a href="https://twitter.com/KEEZZ0" target=”_blank”>
<li>1.2k # Twitter</li>
</a>
<a href="https://www.tiktok.com/#kkeezo?lang=en" target=”_blank”>
<li>1.1k # TikTok</li>
</a>
</ul>
</div>
</div>
</div>
<div class="meet-the-owner">
<h3>Content Manager</h3>
</div>
<div class="luxxreno">
<img src="images/brad-c.png" class="luxx-img">
<div class="q-l">
<div class="questions">
<h2 class="luxx-name">SPODERBRAD</h2>
<h2 class="owner">Content Manager</h2>
<p>Real Name: <b>Brad</b></p>
<p>Online Name: <b>SpoderBrad</b></p>
<p>First Game Played as a Kid: <b>Metal Gear Solid</b></p>
<p>Game I'm Best At: <b>Splitgate</b></p>
<p>If You Were a Superhero, What Would Your Power Be?: <br><b>Honestly don’t want a super power just wanna <br> be Iron Man.</b></p>
<p>Favourite Artist of All Time: <br> <b>Drake or Eminem can’t decide</b></p>
<p>Hidden Talents: <b>Best Free Kick Taker on Twitch.</b></p>
</div>
<div class="luxx-socials">
<ul>
<a href="https://www.youtube.com/channel/UCnqgXWWmmg1F3L919lzT6aQ" target=”_blank”>
<li>353 # YouTube</li>
</a>
<a href="https://www.instagram.com/spoderbrad/?hl=en-gb" target=”_blank”>
<li>115 # Instagram</li>
</a>
<a href="https://www.twitch.tv/SpoderBrad" target=”_blank”>
<li>2.1k # Twitch</li>
</a><br>
<a href="https://twitter.com/SpoderBrad" target=”_blank”>
<li>392 # Twitter</li>
</a>
<a href="https://www.tiktok.com/#spoderbrad?lang=en" target=”_blank”>
<li>60k # TikTok</li>
</a>
</ul>
</div>
</div>
</div>
</section>

Cursor turning into the pointer (hand) before visually reaching the icon

I've already checked the code on DevTools and it shows the problem:
The icon is actually wider than I would like. I've already tried changing its size, padding, margin, etc, but with no good results. Does anyone know how to solve this problem?
Code can be found here
<a href="#about">
<i class="fa fa-angle-double-down fa-stack-1x" style="color: black";></i>
</a>
element.style {
color: black;
}
.fa, .fas {
font-weight: 900;
font-size: 35px;
}
Remove the .fa-stack-1x class on your icon. That will fix it. That class specifically is setting the width to be 100%. I removed it on my browser and it works fine with out it.
You need to add this css code, this prevent icon to be larger (width) and to be centered (left):
.fa-stack-1x, .fa-stack-2x {
left: inherit !important;
width: auto !important;
}
const projectName = 'tribute-page';
html, body {
height: 100%;
width: 100%;
background-color: black;
}
html {
scroll-behavior: smooth;
}
body {
margin: 0;
}
p, h1, h3, h4, cite, ul {
color: #D9D4D0;
font-family: font-family: 'Neucha', cursive;
font-family: 'Open Sans Condensed', sans-serif;;
}
a:link {
text-decoration: none;
}
a:visited {
color: white;
text-decoration: none;
}
a:hover {
color: #D9B384;
text-decoration: none;
}
.header {
width: 100%;
height: 700px;
background: url(https://media.gazetadopovo.com.br/2012/12/7cc68ffc5247e851268670d802a50453-gpMedium.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.text-vertical-center {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-shadow: -1px 1px 0 #D9D4D0,
1px 1px 0 #D9D4D0,
1px -1px 0 #D9D4D0;
-1px -1px 0 #D9D4D0;
-webkit-text-fill-color: black;
}
.text-vertical-center h1 {
margin-bottom: 0;
font-size: 80px;
}
.text-vertical-center h3 {
margin-top: 0;
font-size: 25px;
}
element.style {
color: black;
}
.fa, .fas {
font-weight: 900;
font-size: 35px;
}
.fa-stack-1x, .fa-stack-2x {
left:inherit !important;
width: auto !important;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://kit.fontawesome.com/39c2eebbd7.js" crossorigin="anonymous"></script>
<title>Tribute to Caetano Veloso</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Neucha&family=Open+Sans+Condensed:wght#300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main id="main">
<header class="header">
<div class="text-vertical-center">
<h1>Caetano Veloso</h1>
<h3 id="subheading">an aging chameleon</h3>
<a href="#about">
<i class="fa fa-angle-double-down fa-stack-1x" style="color: black";></i>
</a>
</div>
</header>
<section id="tribute-info" class="container">
<h3 id="about">These are the main events in Caetano's life:</h3>
<ul>
<li><strong>1942</strong> - Born in Santo Amaro, Bahia, Brazil</li>
<li>
<strong>1959</strong> - Hears for the first time the song Chega de Saudade, by Bossa Nova's father João Gilberto. He later recalled: "It was the clearest landmark a song has ever left in my life"
</li>
<li>
<strong>1963</strong> - First musical work. After impressing the director Álvaro Guimarães with a speech on how João Gilberto revitalized Samba, Caetano is invited to compose the soundtrack to the plays Boca de Ouro, by Nelson Rodrigues, and A Exceção e a Regra, by Bertold Bretch.
</li>
<li>
<strong>1965</strong> - Moves to Rio de Janeiro with his sister Maria Betânia
</li>
<li>
<strong>1967</strong> - Releases, in a partnership with Gal Costa, his first album Domingo.
</li>
<li>
<strong>1967</strong> - Releases his first self-titled solo album, giving birth to the Tropicalist movement, which would change the history of Brazilian music.
</li>
<li>
<strong>1968</strong> - Caetano performs the provocative song É Proibido Proibir with Os Mutantes at the 3ª International Song Festival to a booing crowd. Caetano then improvises an angry, and now historical, speech against the judges and the public.
</li>
<li>
<strong>1968</strong> - Because of his political views, Caetano is sent to jail by the Military Regime.
</li>
<li>
<strong>1969</strong> - Caetano moves to England with his friend Gilberto Gil, where he lives in exile until 1972.
</li>
<li>
<strong>1971</strong> - Releases one of his best albums, the acclaimed Transa, which contained covers and songs with English subtitles.
<li>
<strong>1972</strong> - Returns to Brazil and performs with João Gilberto and Gal Costa at TV Tupi.
</li>
<li>
<strong>1980</strong> - Caetano starts growing in popularity abroad, especially in Portugal, Israel, France and Africa.
</li>
<li>
<strong>1983</strong> - Meets Paula Lavigne, who was 14 years old. She would later become his long-time wife, with whom Caetano had 2 kids.
</li>
<li>
<strong>1990</strong> - Participates in the Montreaux Jazz Festival in Switzerland.
</li>
<li><strong>1991</strong> - Writes a profound article to the New York Times about the cultural implications of Carmem Miranda</li>
<li>
<strong>2002</strong> - Launches a book about the tropicalia movement, Tropical Truth: A Story of Music and Revolution in Brazil.
</li>
<li>
<strong>2010</strong> - The artist becomes a constant meme object on the internet.
</li>
<li>
<strong>2016</strong> - Caetano performs at the Rio Olimpic Games with Anitta.
</li>
<li>
<strong>2020</strong> -
Wins a millionaire judicial dispute against Olavo de Carvalho, the intellectual mentor of the Bolsonaro family
</li>
</ul>
<div id="popular-albums-section" class="container">
<div class="row">
<h3 class="popular-albums-header">Caetano's best albums</h3>
<div class="margin-bottom col-sm-6 col-md-3 text-center">
<h4><strong>Transa</strong> - 1972</h4>
<img class="album-photo img-responsive" src="images/caetanotransa.png" alt="Transa album cover">
</div>
<div class="margin-bottom col-sm-6 col-md-3 text-center">
<h4><strong>Qualquer coisa</strong> - 1975</h4>
<img class="album-photo img-responsive" src="images/qualquercoisa.png" alt="Qualquer Coisa album cover">
</div>
<div class="margin-bottom col-sm-6 col-md-3 text-center">
<h4><strong>Cinema Transcendental</strong> - 1979</h4>
<img class="album-photo img-responsive" src="images/Cinema_Transcendental_cover.png" alt="Cinema Transcendental Cover">
</div>
<div class="margin-bottom col-sm-6 col-md-3 text-center">
<h4><strong>Bicho</strong> - 1977</h4>
<img class="album-photo img-responsive" src="images/Capa_de_Bicho.png" alt="Bicho album cover">
</div>
<div class="margin-bottom col-sm-6 col-md-3 text-center">
<h4><strong>Cores, Nomes</strong> - 1982</h4>
<img class="album-photo img-responsive" src="images/coresnomescover.png" alt="Cores, Nomes album cover">
</div>
</div>
</div>
<br>
<p>
"When imagined by American critics, the most frequent cliché used about the legendary singer Caetano Veloso is that he is the Bob Dylan of Brazil. In that case, the best Dylan song to associate with Veloso would be "Forever Young," because Veloso is one of the most restlessly creative, forward-looking musicians of our time."
</p>
<cite>-- Author Ed Morales</cite>
</blockquote>
<h3>If you're interested, you should read more about this incredible human being on his
<a id="tribute-link" href="https://en.wikipedia.org/wiki/Caetano_Veloso" target="_blank">Wikipedia entry</a>.
</h3>
</section>
</main>
</body>
</html>

How do I position the divs in my Spotify homepage footer clone to mimic the original's layout?

A couple questions:
How do I make the text in <div class="mh-top-links"> align left?
How do I make the social media links in <div class="mh-social-icons"> display in a row?
How do I make the links in <div class="mh-bottom-links"> display in a row?
Overall, how would you arrange the divs in the footer to make it appear the way it does on the original website? See photo for reference.
I've messed around with Chrome DevTools and tried everything I can think of, but I'm still very new to this and don't know what I'm doing. If you can please provide an explanation along with your answer so I can apply the logic on my own next time, that'd be greatly appreciated!
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
font-family: Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 1.5;
color: #222326;
background-color: #FFF;
margin: 0;
}
/* Footer */
footer {
background: #000;
}
footer .mh-top-links {
width: 50%;
display: flex;
flex-direction: row;
}
footer .mh-top-links dt{
color: #919496;
margin-bottom: 20px;
font-size: 12px;
font-weight: 900;
line-height: 1.4;
letter-spacing: .08em;
text-transform: uppercase;
}
footer .mh-top-links dd {
padding: 3px 0 15px;
}
footer .mh-top-links a {
color: #fff;
font-size: 16px;;
text-decoration: none;
}
footer .mh-social-icons a{
color: #fff;
text-decoration: none;
border: 1px solid #fff;
padding: 10px;
border-radius: 50%;
display: inline-block;
}
footer .mh-social-icons {
list-style: none;
}
footer .mh-country a {
color: #fff;
text-decoration: none;
}
footer .mh-bottom-links li{
list-style: none;
}
footer .mh-bottom-links a {
color: #919496;
text-decoration: none;
font-size: 14px;
}
footer a:hover {
color: #1ED760;
}
footer .footer-logo {
margin: 0;
display: inline-block;
color: #fff;
text-decoration: none;
}
<body>
<footer id="mh-footer" class="mh-footer-hover">
<nav>
<div class="mh-brand">
<a href="#" class="mh-footer-primary">
<span class="footer-logo">
Spotify
</span>
</a>
</div>
<div class="mh-top-links">
<dl class="empresa">
<dt>Empresa</dt>
<dd>
<a href="#">
Acerca de
</a>
</dd>
<dd>
<a href="#">
Empleo
</a>
</dd>
<dd>
<a href="#">
For the Record
</a>
</dd>
</dl>
<dl class="comunidades">
<dt>Comunidades</dt>
<dd>
<a href="#">
Para artistas
</a>
</dd>
<dd>
<a href="#">
Desarrolladores
</a>
</dd>
<dd>
<a href="#">
Publicidad
</a>
</dd>
<dd>
<a href="#">
Inversores
</a>
</dd>
<dd>
<a href="#">
Proveedores
</a>
</dd>
</dl>
<dl class="enlaces">
<dt>Enlaces Útiles</dt>
<dd>
<a href="#">
Ayuda
</a>
</dd>
<dd>
<a href="#">
Reproductor web
</a>
</dd>
<dd>
<a href="#">
App gratis para móvil
</a>
</dd>
</dl>
</div>
<div class="mh-social-icons">
<ul>
<li>
<a href="#" title="Instagram">
<span>IG</span>
</a>
</li>
<li>
<a href="#" title="Twitter">
<span>TW</span>
</a>
</li>
<li>
<a href="#" title="Facebook">
<span>FB</span>
</a>
</li>
</ul>
</div>
<div class="mh-country">
<a href="#">
España
<img src="https://country-flags.scdn.co/flags/es.svg" alt="Spanish flag" class="flag">
</a>
</div>
<div class="mh-bottom-links">
<ul>
<li>
Legal
</li>
<li>
Centro de Privacidad
</li>
<li>
Politica de Privacidad
</li>
<li>
Cookies
</li>
<li>
Informacion sobre los anuncios
</li>
</ul>
<span class="copyright">© 2020 Spotify AB</span>
</div>
</nav>
</footer>
</body>
In my experience, Flexbox is the best thing to use to layout things like this. There are lots of other ways of doing it (floats, CSS Grid, tables etc..), but Flexbox allows you to do it with the least amount of hacks, the least amount of code, and is also pretty much universally supported, as long as you don't need to support IE. CanIUse demonstrates the support, so be sure to check first and make a decision based on your requirements.
In my example, I have simplified the code somewhat and added some HTML colors to make it clearer what is going on. I have also created a JSFiddle of it.
The general solution is to separate the content into two main rows and apply display:flex to each of these. I have had to rearrange the HTML a bit to facilitate this. justify-content: flex-start makes the content align to the left. align-items: flex-start; prevents the elements stretching across the height of the row. The social media icons have been forced to align right by the trick of adding margin-left: auto to their containing element.
Flexbox is also used to layout content in some of the nested containers, such as for the legal links and the social media icons to force them to display in a row.
Some of the alignment problems you have are due to browser styling defaults, for example the dd element has a default margin set on it, so it's a good idea to use a CSS reset stylesheet to remove all of these in order to prevent unwelcome surprises. I happen to like Meyer's because it just blasts everything away, but it should be said that some people prefer something less drastic.
Another problem you have is that the circular borders round your social media icons are a bit skewed. This happens because the elements themselves are not perfectly square. The solution is to force them to be so by setting a width and height on them.
<footer id="mh-footer" class="mh-footer-hover">
<nav>
<div class="row-1">
<div class="mh-brand">
<a href="#" class="mh-footer-primary">
<span class="footer-logo">
Spotify
</span>
</a>
</div>
<div class="mh-top-links">
<dl class="mh-top-links__list">
<dt>Empresa</dt>
<dd>
<a href="#">
Acerca de
</a>
</dd>
<dd>
<a href="#">
Empleo
</a>
</dd>
<dd>
<a href="#">
For the Record
</a>
</dd>
</dl>
<dl class="mh-top-links__list">
<dt>Comunidades</dt>
<dd>
<a href="#">
Para artistas
</a>
</dd>
<dd>
<a href="#">
Desarrolladores
</a>
</dd>
<dd>
<a href="#">
Publicidad
</a>
</dd>
<dd>
<a href="#">
Inversores
</a>
</dd>
<dd>
<a href="#">
Proveedores
</a>
</dd>
</dl>
<dl class="mh-top-links__list">
<dt>Enlaces Útiles</dt>
<dd>
<a href="#">
Ayuda
</a>
</dd>
<dd>
<a href="#">
Reproductor web
</a>
</dd>
<dd>
<a href="#">
App gratis para móvil
</a>
</dd>
</dl>
</div>
<ul class="mh-social-icons">
<li>
<a class="mh-social-icon" href="#" title="Instagram">
<span>IG</span>
</a>
</li>
<li>
<a class="mh-social-icon" href="#" title="Twitter">
<span>TW</span>
</a>
</li>
<li>
<a class="mh-social-icon" href="#" title="Facebook">
<span>FB</span>
</a>
</li>
</ul>
</div>
<div class="row-2">
<ul class="mh-legal-links">
<li>
Legal
</li>
<li>
Centro de Privacidad
</li>
<li>
Politica de Privacidad
</li>
<li>
Cookies
</li>
<li>
Informacion sobre los anuncios
</li>
</ul>
<div class="mh-country-copyright">
<div class="mh-country">
<a href="#">
España
<img src="https://country-flags.scdn.co/flags/es.svg" alt="Spanish flag" class="flag">
</a>
</div>
<span class="copyright">© 2020 Spotify AB</span>
</div>
</div>
</nav>
</footer>
/* reset browser styles in one place */
body,
dl,
dt,
dd,
ol,
ul,
li {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
ol,
ul {
list-style: none;
}
/* apply a natural box layout model to all elements, but allowing components to change */
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
min-height: 100vh;
}
.row-1 {
display: flex;
justify-content: flex-start;
align-items: flex-start;
background: pink;
}
.mh-brand {
background: chartreuse;
padding: 0 50px;
}
.mh-top-links {
display: flex;
background: orange;
width: 50%;
}
.mh-top-links__list {
margin: 0 5px;
background: purple;
width: 200px;
flex-shrink: 0;
}
.mh-social-icons {
display: flex;
background: chocolate;
margin-left: auto;
}
.mh-social-icon {
color: #fff;
text-decoration: none;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
border-radius: 50%;
display: inline-block;
margin: 5px;
border-radius: 50%;
border: 1px solid #fff;
background: grey;
}
.row-2 {
display: flex;
background: coral;
}
.mh-legal-links {
background: green;
display: flex;
align-items: flex-start;
}
.mh-legal-links > li {
margin: 5px;
background: blanchedalmond;
}
.mh-country-copyright {
margin-left: auto;
}
See the below code for Question 1 - 3
You can just add the properties to your existing classes.
First line is for question 1. The second line of code is for Question 2 & 3
.mh-top-links{align-items: flex-start}
.mh-social-icons li , .mh-bottom-links li{ display:inline;}
The fourth question HTML layout as per below
<footer id="mh-footer" class="mh-footer-hover">
<nav class="navclass">
<div class="mh-brand svelte-1cgydzu">LOGO</span></a></div>
<div class="mh-top-links">
<dl class="classname">
<dt class="classname">Company</dt>
<dd class="classname">About </dd>
<dd class="classname">Jobs </dd>
<dd class="classname">For the Record </dd>
</dl>
<dl class="classname">
<dt class="classname">Communities</dt>
<dd class="classname">For Artists </dd>
<dd class="classname">Developers </dd>
<dd class="classname">Advertising </dd>
<dd class="classname">Investors </dd>
<dd class="classname">Vendors </dd>
</dl>
<dl class="classname">
<dt class="classname">Useful links</dt>
<dd class="classname">Help </dd>
<dd class="classname">Web Player </dd>
<dd class="classname">Free Mobile App </dd>
</dl>
</div>
<div class="mh-social-icons">
<ul class="classname">
<li class="classname"><span class="mh-social-icon-instagram"></span></li>
<li class="classname"><span class="mh-social-icon-fb"></span></li>
<li class="classname"><span class="mh-social-icon-tw"></span></li>
</ul>
</div>
<div class="mh-country">
Coutry
</div>
<div class="mh-bottom-links">
<ul class="yourclass">
<li class="yourclass">Legal </li>
<li class="yourclass">Privacy Center </li>
<li class="yourclass">Privacy Policy </li>
<li class="yourclass">Cookies </li>
<li class="yourclass">About Ads </li>
</ul>
<span class="class">© 2020 Spotify AB</span>
</div>
</nav>
</footer>
Just add your own class names :)

CSS Float Left Inconsistencies Elements Randomly Jump Row

I've been trying to write custom CSS for styling of related posts which appear under each article of my website. Each related post consists of 1 thumbnail and 1 text headline.
There are 8 in total under each page grouped in a UL list, and the LI elements are floated to the Left so they display in 2 rows.
Problem is for some reason occasionally I have LI items which jump row for now apparent reason.
Here is an example:
Screenshot
This is the html part of the code:
<div class="crp_related ">
<h3>Related Stories:</h3>
<ul>
<li style="padding-top: 10px">
<a href="./document-reveals-isis-plot-for-world-domination-in-chilling-detail-full-translation-below/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Document reveals ISIS plot for world domination in chilling detail: Full translation below" alt="Document reveals ISIS plot for world domination in chilling detail: Full translation below"
src="./wp-content/uploads/2015/12/Screen-Shot-2015-12-07-at-12.45.19-PM-150x150.png">
</a>
<br>
<a class="crp_title" href="./document-reveals-isis-plot-for-world-domination-in-chilling-detail-full-translation-below/">Document reveals ISIS plot for world domination in chilling…</a>
</li>
<li style="padding-top: 10px">
<a href="./devout-us-muslim-and-his-saudi-wife-left-their-baby-at-home-to-storm-back-to-office-christmas-party-with-automatic-weapons-and-slaughter-14-of-his-colleagues-before-dying-in-police-shoot-out/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Devout’ US Muslim and his Saudi wife left their baby at home to storm back to office Christmas party with automatic weapons and slaughter 14 of his colleagues before dying in police shoot-out"
alt="‘Devout’ US Muslim and his Saudi wife left their baby at home to storm back to office Christmas party with automatic weapons and slaughter 14 of his colleagues before dying in police shoot-out" src="./wp-content/uploads/2015/12/farook1-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./devout-us-muslim-and-his-saudi-wife-left-their-baby-at-home-to-storm-back-to-office-christmas-party-with-automatic-weapons-and-slaughter-14-of-his-colleagues-before-dying-in-police-shoot-out/">‘Devout’ US Muslim and his Saudi wife left their</a>
</li>
<li style="padding-top: 10px">
<a href="./obama-we-lose-when-america-scrutinizes-muslims-betrayal-of-our-values/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Obama: ‘We Lose’ When America Scrutinizes Muslims… ‘Betrayal of Our Values’" alt="Obama: ‘We Lose’ When America Scrutinizes Muslims… ‘Betrayal of Our Values’"
src="./wp-content/uploads/2015/12/Obama126-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./obama-we-lose-when-america-scrutinizes-muslims-betrayal-of-our-values/">Obama: ‘We Lose’ When America Scrutinizes…</a>
</li>
<li style="padding-top: 10px">
<a href="./great-partners-pentagon-rejects-russian-evidence-of-turkey-aiding-isis/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Great partners’: Pentagon rejects Russian evidence of Turkey aiding ISIS" alt="‘Great partners’: Pentagon rejects Russian evidence of Turkey aiding ISIS"
src="./wp-content/uploads/2015/12/565f3967c461884a3d8b4627-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./great-partners-pentagon-rejects-russian-evidence-of-turkey-aiding-isis/">‘Great partners’: Pentagon rejects Russian…</a>
</li>
<li style="padding-top: 10px">
<a href="./7-isis-facts-every-american-must-know/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="7 ISIS Facts Every American Must Know" alt="7 ISIS Facts Every American Must Know" src="./wp-content/uploads/2015/12/ISIS-Genocide-in-Iraq-AP-Photo-640x480.jpg">
</a>
<br>
<a class="crp_title" href="./7-isis-facts-every-american-must-know/">7 ISIS Facts Every American Must Know</a>
</li>
<li style="padding-top: 10px">
<a href="./will-your-city-or-state-be-the-next-san-bernardino-at-least-22-verified-islamic-terror-training-camps-in-us-all-under-the-watchful-eye-of-the-fbi/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Will Your City or State be the Next San Bernardino? At Least 22 Verified Islamic Terror Training Camps in US – All Under the Watchful Eye of the FBI"
alt="Will Your City or State be the Next San Bernardino? At Least 22 Verified Islamic Terror Training Camps in US – All Under the Watchful Eye of the FBI" src="./wp-content/uploads/2015/12/120515_2259_WillYourCit1-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./will-your-city-or-state-be-the-next-san-bernardino-at-least-22-verified-islamic-terror-training-camps-in-us-all-under-the-watchful-eye-of-the-fbi/">Will Your City or State be the Next San Bernardino? At Least</a>
</li>
<li style="padding-top: 10px">
<a href="./allah-took-their-sanity-putin-accuses-turkish-leadership-of-aiding-terror/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Allah took their sanity’: Putin accuses Turkish leadership of ‘aiding terror’" alt="‘Allah took their sanity’: Putin accuses Turkish leadership of ‘aiding terror’"
src="./wp-content/uploads/2015/12/56600a0dc46188c3078b45e7-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./allah-took-their-sanity-putin-accuses-turkish-leadership-of-aiding-terror/">‘Allah took their sanity’: Putin accuses Turkish…</a>
</li>
<li style="padding-top: 10px">
<a href="./russian-warplanes-hit-1458-terrorist-targets-in-syria-over-past-week/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over Past Week" alt="Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over Past Week"
src="./wp-content/uploads/2015/12/1028392998-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./russian-warplanes-hit-1458-terrorist-targets-in-syria-over-past-week/">Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over…</a>
</li>
</ul>
<div class="crp_clear">
</div>
</div>
And this is the CSS part:
div.crp_related {
clear: both;
margin: 10px 0;
}
div.crp_related h3 {
margin: 0 !important;
}
div.crp_related ul {
list-style: none;
float: left;
margin: 0 !important;
padding: 0 !important;
}
div.crp_related li, div.crp_related a {
float: left;
overflow: hidden;
position: relative;
text-align: left;
display: table-cell;
}
div.crp_related li {
margin: 5px !important;
padding: 6px;
}
div.crp_related li:hover {
background: #eee;
}
div.crp_related a:hover {
text-decoration: none;
}
div.crp_related img {
max-width: 150px;
max-height: 150px;
min-height: 150px;
min-width: 150px;
margin: auto;
display: block;
overflow: hidden;
}
div.crp_related .crp_title {
position: relative;
max-width: 150px;
height: 100%;
padding-left: 0px;
padding-right: 3px;
padding-top: 3px;
padding-bottom: 3px;
color: #dc291e;
font-size: 12pt;
font-weight: bold;
}
div.crp_related .crp_thumb, div.crp_related li, div.crp_related .crp_title {
vertical-align: bottom;
}
.crp_clear {
clear: both;
}
Why is this happening?
What am I doing wrong?
Add following div after every four records.
<div style='clear:both'></div>
Please post a snippet of code with both CSS and HTML together.
1)
Probably the problem is due to the fact that in the first row the first 2 articles have a longer crp_title and it spans 4 rows, but in the other 2 articles crp_title spans 3 rows.
A floating element going in a new line tries to go up, and the reason why the second articles' row goes right is that the 3rd and 4th articles of the first row have a smaller height.
You can easily check it with your browser inspector.
2)clear:both after the last element of each row
A quick fix can be setting a fixed height in px of your .crp_title
This should do the trick:
div.crp_related > ul > li:nth-child(4):after {
content: '';
clear: both;
display: block;
visibility: hidden;
height: 0px;
}
This issue is due to unequal height of floated content, so you need to clear float and get next element on new row. You can do that using nth-child selectors.
div.crp_related {
clear: both;
margin: 10px 0;
}
div.crp_related h3 {
margin: 0 !important;
}
div.crp_related ul {
list-style: none;
float: left;
margin: 0 !important;
padding: 0 !important;
}
div.crp_related li,
div.crp_related a {
float: left;
overflow: hidden;
position: relative;
text-align: left;
display: table-cell;
}
div.crp_related li {
margin: 5px !important;
padding: 6px;
}
div.crp_related li:hover {
background: #eee;
}
div.crp_related a:hover {
text-decoration: none;
}
div.crp_related img {
max-width: 150px;
max-height: 150px;
min-height: 150px;
min-width: 150px;
margin: auto;
display: block;
overflow: hidden;
}
div.crp_related .crp_title {
position: relative;
max-width: 150px;
height: 100%;
padding-left: 0px;
padding-right: 3px;
padding-top: 3px;
padding-bottom: 3px;
color: #dc291e;
font-size: 12pt;
font-weight: bold;
}
div.crp_related .crp_thumb,
div.crp_related li,
div.crp_related .crp_title {
vertical-align: bottom;
}
.crp_clear {
clear: both;
}
/* THIS IS DUE TO UNEQUAL HEIGHT OF FLOATED CONTENT, so Clear Float on every 5th element */
#media (min-width: 768px) {
div.crp_related li:nth-child(4n+1) {
clear: both;
}
}
#media (max-width: 767px) {
div.crp_related li:nth-child(3n+1) {
clear: both;
}
<div class="crp_related ">
<h3>Related Stories:</h3>
<ul>
<li style="padding-top: 10px">
<a href="./document-reveals-isis-plot-for-world-domination-in-chilling-detail-full-translation-below/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Document reveals ISIS plot for world domination in chilling detail: Full translation below" alt="Document reveals ISIS plot for world domination in chilling detail: Full translation below"
src="./wp-content/uploads/2015/12/Screen-Shot-2015-12-07-at-12.45.19-PM-150x150.png">
</a>
<br>
<a class="crp_title" href="./document-reveals-isis-plot-for-world-domination-in-chilling-detail-full-translation-below/">Document reveals ISIS plot for world domination in chilling…</a>
</li>
<li style="padding-top: 10px">
<a href="./devout-us-muslim-and-his-saudi-wife-left-their-baby-at-home-to-storm-back-to-office-christmas-party-with-automatic-weapons-and-slaughter-14-of-his-colleagues-before-dying-in-police-shoot-out/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Devout’ US Muslim and his Saudi wife left their baby at home to storm back to office Christmas party with automatic weapons and slaughter 14 of his colleagues before dying in police shoot-out"
alt="‘Devout’ US Muslim and his Saudi wife left their baby at home to storm back to office Christmas party with automatic weapons and slaughter 14 of his colleagues before dying in police shoot-out" src="./wp-content/uploads/2015/12/farook1-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./devout-us-muslim-and-his-saudi-wife-left-their-baby-at-home-to-storm-back-to-office-christmas-party-with-automatic-weapons-and-slaughter-14-of-his-colleagues-before-dying-in-police-shoot-out/">‘Devout’ US Muslim and his Saudi wife left their</a>
</li>
<li style="padding-top: 10px">
<a href="./obama-we-lose-when-america-scrutinizes-muslims-betrayal-of-our-values/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Obama: ‘We Lose’ When America Scrutinizes Muslims… ‘Betrayal of Our Values’" alt="Obama: ‘We Lose’ When America Scrutinizes Muslims… ‘Betrayal of Our Values’"
src="./wp-content/uploads/2015/12/Obama126-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./obama-we-lose-when-america-scrutinizes-muslims-betrayal-of-our-values/">Obama: ‘We Lose’ When America Scrutinizes…</a>
</li>
<li style="padding-top: 10px">
<a href="./great-partners-pentagon-rejects-russian-evidence-of-turkey-aiding-isis/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Great partners’: Pentagon rejects Russian evidence of Turkey aiding ISIS" alt="‘Great partners’: Pentagon rejects Russian evidence of Turkey aiding ISIS"
src="./wp-content/uploads/2015/12/565f3967c461884a3d8b4627-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./great-partners-pentagon-rejects-russian-evidence-of-turkey-aiding-isis/">‘Great partners’: Pentagon rejects Russian…</a>
</li>
<li style="padding-top: 10px">
<a href="./7-isis-facts-every-american-must-know/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="7 ISIS Facts Every American Must Know" alt="7 ISIS Facts Every American Must Know" src="./wp-content/uploads/2015/12/ISIS-Genocide-in-Iraq-AP-Photo-640x480.jpg">
</a>
<br>
<a class="crp_title" href="./7-isis-facts-every-american-must-know/">7 ISIS Facts Every American Must Know</a>
</li>
<li style="padding-top: 10px">
<a href="./will-your-city-or-state-be-the-next-san-bernardino-at-least-22-verified-islamic-terror-training-camps-in-us-all-under-the-watchful-eye-of-the-fbi/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Will Your City or State be the Next San Bernardino? At Least 22 Verified Islamic Terror Training Camps in US – All Under the Watchful Eye of the FBI"
alt="Will Your City or State be the Next San Bernardino? At Least 22 Verified Islamic Terror Training Camps in US – All Under the Watchful Eye of the FBI" src="./wp-content/uploads/2015/12/120515_2259_WillYourCit1-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./will-your-city-or-state-be-the-next-san-bernardino-at-least-22-verified-islamic-terror-training-camps-in-us-all-under-the-watchful-eye-of-the-fbi/">Will Your City or State be the Next San Bernardino? At Least</a>
</li>
<li style="padding-top: 10px">
<a href="./allah-took-their-sanity-putin-accuses-turkish-leadership-of-aiding-terror/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="‘Allah took their sanity’: Putin accuses Turkish leadership of ‘aiding terror’" alt="‘Allah took their sanity’: Putin accuses Turkish leadership of ‘aiding terror’"
src="./wp-content/uploads/2015/12/56600a0dc46188c3078b45e7-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./allah-took-their-sanity-putin-accuses-turkish-leadership-of-aiding-terror/">‘Allah took their sanity’: Putin accuses Turkish…</a>
</li>
<li style="padding-top: 10px">
<a href="./russian-warplanes-hit-1458-terrorist-targets-in-syria-over-past-week/">
<img width="150" height="150" onerror="this.onerror=null;this.src='./no-thumbnail.jpg';" class="crp_thumb crp_correctfirst" title="Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over Past Week" alt="Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over Past Week"
src="./wp-content/uploads/2015/12/1028392998-150x150.jpg">
</a>
<br>
<a class="crp_title" href="./russian-warplanes-hit-1458-terrorist-targets-in-syria-over-past-week/">Russian Warplanes Hit 1,458 Terrorist Targets in Syria Over…</a>
</li>
</ul>
<div class="crp_clear">
</div>
</div>
I think the coding it's pretty much simpler. Take a look at this snippet:
ul li {
width: 200px;
height: 200px;
border: 1px solid #000;
float: left;
list-style: none;
margin-top: 40px;
margin-right: 40px;
}
ul li:last-child {
margin-right: 0;
}
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
This is the base, now you can add the image and description. This ul will fit to container's width.
Hope it helps