No more content will display below DIV - html

I'm trying to add the a footer image below these two messages. The bottom one is transparent and anything that I add below "message 2" goes behind instead of below it, How do I keep editing below these?
In theory adding even just some text like
<p>hello</p>
should appear below. It shows behind the message 2 div and doesn't allow me to actually edit below, it edits behind. How would I go about fixing this?
<style>
body {
display: flex;
height: 100vh;
margin: 0;
flex-direction: column;
}
.message1 {
flex: 1;
align-items: center;
display: flex;
max-height: 100px;
background-color: #f0f0f0;
}
.message2 {
flex: 1;
align-items: center;
display: flex;
max-height: 100px;
background-color: #3a3a3a;
}
a {
text-decoration: none;
color: ##6d1a76;
}
</style>
<style>
.messagetext {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 20px;
padding: 0px;
</style>
<div class="message1">
<div class="messagetext">
<p class="Roboto">URL TEXT</p>
</div>
</div>
<div class="message2">
<div class="messagetext">
<font size="3" color="#ffffff">
<p class="Roboto">TEXT</p>
</font>
</div>
<div>
<br>
<style>
.footer {
position: fixed;
bottom: 0%;
width: 100%;
}
</style>
<!--Footer-->
<div class="footer" src="FOOTER IMAGE" width="80%" alt="Footer"> </div>
<br>
If you try adding text below it just shows next to the existing text, I need it to show below.

Your footer has position: fixed and bottom: 0%;, so it is at the bottom of the page (I gave it a height and made its background yellow to make it visible, BTW an src attribute in the footer DIV won't produce an image).
The position: fixed also takes it out of the rest of the document flow, so whatever come * after* the footer will simply follow whatever is before the footer.
Additionally, you had a few minor mistakes/typos in your code - unclosed tags both in HTML and CSS rules. I split it in CSS and HTML to make it clearer in my snippet below
body {
display: flex;
height: 100vh;
margin: 0;
flex-direction: column;
}
.message1 {
flex: 1;
align-items: center;
display: flex;
max-height: 100px;
background-color: #f0f0f0;
}
.message2 {
flex: 1;
align-items: center;
display: flex;
max-height: 100px;
background-color: #3a3a3a;
}
a {
text-decoration: none;
color: #6d1a76;
}
.messagetext {
margin-top: 0px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 20px;
padding: 0px;
}
.footer {
position: fixed;
bottom: 0%;
width: 100%;
height: 100px;
background: #ffffaa;
}
<div class="message1">
<div class="messagetext">
<p class="Roboto">URL TEXT</p>
</div>
</div>
<div class="message2">
<div class="messagetext">
<font size="3" color="#ffffff">
<p class="Roboto">TEXT</p>
</font>
</div>
<!--Footer-->
<div class="footer" src="FOOTER IMAGE" width="80%" alt="Footer"> </div>
<p>THIS IS BELOW THE FOOTER IN THE HTML CODE, but above it in the document flow</p>

Related

problems with alignment css / fcc project

I'm trying to build a product landing page as a certificate project for freeCodeCamp.
I can't understand how to fix the icons to the left, while fixing the feature and price to the center. And I can't understand why my li items are overflowing over their container.
I tried all the overflow and wrap tags I know but I can't work it out.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-family: 'Montserrat', sans-serif;
}
#logo {
position: absolute;
width: 25%;
left: 0;
height: auto;
image-resolution: 100%;
}
header {
width: 100%;
display: flex;
justify-content: space-evenly;
}
.navspace {
justify-content: end;
position: relative;
right: -15%;
}
nav {
positio: relative;
}
ul {
display: flex;
list-style: none;
}
li {
margin: 40px;
}
.product {
position: absolute;
top: 15%;
}
#leads {
width: 100vw;
display: flex;
flex-direction: column;
text-align: center;
justify-content: center;
align-items: center;
}
.title {
padding: 2%;
}
#logo-green {
width: 5vw;
height: auto;
margin-right: 5vw;
}
#Features {
margin-left: 27%;
display: flex;
align-items: left;
justify-content: left;
text-align: left;
padding: 5%;
}
#Price {
display: flex;
align-items: center;
justify-content: left;
text-align: center;
padding: 3%;
margin-left: 27%;
}
.price {
display: flex;
flex-direction: column;
text-align: left;
}
.pricelist {
width: 100%;
max-height: 400px;
text-align: center;
position: absolute;
display: inline-flex;
justify-content: center;
}
.class {
width: 300px;
height: 300px;
border: 1px solid black;
margin: 20px;
}
.class>h1 {
width: 100%;
height: 10%;
background-color: blanchedalmond;
padding: 2%;
font-size: large;
}
#medium,
#pika,
#base {
display: flex;
flex-direction: column;
}
.class>h2 {
margin: 5% 0 5% 0;
}
.class>ul {
display: grid;
display: flex;
justify-content: center;
flex-direction: column;
gap: 2px;
}
.class>li {
position: relative;
}
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'>
<!-- tabella nav -->
<header>
<div>
<img id="logo" src="img/LIGHTSPEED.png" alt="" />
</div>
<!-- bhr -->
<div class="navspace">
<nav id="nav-link">
<ul>
<li>Features</li>
<li>Price</li>
<li>Contacts</li>
</ul>
</nav>
</div>
</header>
<main class="product">
<!-- form -->
<section id="leads">
<h2 class="title">Most efficient way to light your life</h2>
<form action="">
<input class="email" type="email" required placeholder="Enter your email" columns="10">
<input class="submit" type="submit" value="Get Shocked">
</form>
</section>
<!-- features -->
<section>
<div id="Features">
<div id="green">
<img id="logo-green" src="img/294432.png" alt="">
</div>
<div class="feature">
<h2>Only from renovable energy</h2>
<p>Coming from water and earth termal energy</p>
</div>
</div>
</section>
<!-- price -->
<section>
<div id="Price">
<div id="cheap">
<img id="logo-green" src="img/low-price.png" alt="">
</div>
<div class="price">
<h2>Prices you have never seen</h2>
<p>With our funding system you might get some solar panels</p>
<p>and who knows... we might pay you your energy.</p>
</div>
</div>
</section>
<div class="pricelist">
<div class="class" id="base">
<h1>BASE LEVEL</h1>
<h2>49€</h2>
<ul>
<li>Standart power transmission</li>
<li>Change power output by your personal profile</li>
<li>Client Support 10am-20am</li>
</ul>
</div>
<div class="class" id="medium">
<h1>MEDIUM LEVEL</h1>
<h2>59€</h2>
</div>
<div class="class" id="pika">
<h1>PIKACHU LEVEL</h1>
<h2>149€</h2>
</div>
</div>
</main>
A few things right off the bat, i've added some comments to your CSS. There's a lot going on here, and I think a lot of your styling is just working against you.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-family: 'Montserrat', sans-serif;
}
#logo {
position: absolute;
width: 25%;
left: 0;
height: auto;
image-resolution: 100%;
}
header {
width: 100%;
display: flex;
justify-content: space-evenly;
}
.navspace {
justify-content: end;
position: relative;
right: -15%;
}
nav {
position: relative; /* <- mispelled positio[n] */
}
ul {
display: flex;
list-style: none;
}
li {
margin: 40px;
}
.product {
position: absolute; /* I hate position absolute. Hate it deeply. Basically refuse to use it. It never works the way I want it to. More on this in response below */
top: 15%;
}
#leads {
width: 100vw;
display: flex;
flex-direction: column;
text-align: center;
justify-content: center;
align-items: center;
}
.title {
padding: 2%;
}
#logo-green {
width: 5vw;
height: auto;
margin-right: 5vw;
}
#Features {
margin-left: 27%;
display: flex;
align-items: left;
justify-content: left;
text-align: left;
padding: 5%;
}
#Price { /* be careful, classes and Ids are case sensitive*/
display: flex;
align-items: center;
justify-content: left;
text-align: center;
padding: 3%;
margin-left: 27%;
}
.price {
display: flex;
flex-direction: column;
text-align: left;
}
.pricelist {
width: 100%;
max-height: 400px;
text-align: center;
position: absolute;
display: inline-flex; /* technically, unless this object has a sibling, making it inline-flex while it is position: absolute; won't really change anything... though it could in unexpected ways. More below*/
justify-content: center;
}
.class {
width: 300px;
height: 300px;
border: 1px solid black;
margin: 20px;
}
.class>h1 {
width: 100%;
height: 10%;
background-color: blanchedalmond;
padding: 2%;
font-size: large;
}
#medium,
#pika,
#base {
display: flex;
flex-direction: column;
}
.class>h2 {
margin: 5% 0 5% 0;
}
.class>ul {
display: grid;
display: flex;/* display grid is just being overridden by display flex here, so there's no point in keeping it */
justify-content: center;
flex-direction: column;
gap: 2px;
}
.class>li {
position: relative;
}
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'>
<!-- tabella nav -->
<header>
<div>
<img id="logo" src="img/LIGHTSPEED.png" alt="" />
</div>
<!-- bhr -->
<div class="navspace">
<nav id="nav-link">
<ul>
<li>Features</li>
<li>Price</li>
<li>Contacts</li>
</ul>
</nav>
</div>
</header>
<main class="product">
<!-- form -->
<section id="leads">
<h2 class="title">Most efficient way to light your life</h2>
<form action="">
<input class="email" type="email" required placeholder="Enter your email" columns="10">
<input class="submit" type="submit" value="Get Shocked">
</form>
</section>
<!-- features -->
<section>
<div id="Features">
<div id="green">
<img id="logo-green" src="img/294432.png" alt="">
</div>
<div class="feature">
<h2>Only from renovable energy</h2>
<p>Coming from water and earth termal energy</p>
</div>
</div>
</section>
<!-- price -->
<section>
<div id="Price">
<div id="cheap">
<img id="logo-green" src="img/low-price.png" alt="">
</div>
<div class="price">
<h2>Prices you have never seen</h2>
<p>With our funding system you might get some solar panels</p>
<p>and who knows... we might pay you your energy.</p>
</div>
</div>
</section>
<div class="pricelist">
<div class="class" id="base">
<h1>BASE LEVEL</h1>
<h2>49€</h2>
<ul>
<li>Standart power transmission</li>
<li>Change power output by your personal profile</li>
<li>Client Support 10am-20am</li>
</ul>
</div>
<div class="class" id="medium">
<h1>MEDIUM LEVEL</h1>
<h2>59€</h2>
</div>
<div class="class" id="pika">
<h1>PIKACHU LEVEL</h1>
<h2>149€</h2>
</div>
</div>
</main>
First off, while it is somewhat a personal choice and somewhat just the way most people use CSS these days: I hate position: absolute. It never acts the way you want it to, it's very difficult to get it to be responsive, and there are better ways to do it these days. The problem with absolute is that it simultaneously breaks an object out of the standard flow of the document, but it also gets rid of the object's ability to affect other objects in the document. This means that a div with position:absolute will no longer push down its sibling objects (things next to it), hold space within the parent object (the thing holding it will act like it has nothing inside it). While it's more complicated, using grid to break objects out of the normal document flow is more predictable.
Let's take a look at your code simply without position: absolute:
https://jsfiddle.net/slingtruchoice/sye5wbmu/
already, things aren't breaking outside of your boxes.
Your best bet to get things to align is to use use margin and display:block. Remember, inline items don't hold their own line in a document, they allow other inline items to butt up next to them in the same line, so they won't be affected by margin and padding in the same way. display:inline-block fixes some of that, but not everything.
i literally have this as a poster in my office. I've been doing this for ten years and still use it daily: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
if an item is overflowing out of the container, it's because the container isn't recognizing that it needs to be affected by the child's size. This either means that the parent has a fixed size that overrides the child's desire to make the parent bigger (like a pregnant lady wearing a corset, as my teacher always said... such a weird image).
It may also mean that the child's size isn't affecting things around it, such as a position:absolute or display:inline item that is acting weird. If you have display:flex and flex-wrap: nowrap on the parent, but the children are set to have a size larger than the parent object, then they will overflow.
I'm sure about what icons you are talking about, I would be happy to help you If can clarify the issue. Now about the why your li items are overflowing over their container.
In your CSS on the line number 94 and 103 you set max-height: 400px; and height: 300px; because of that your li items are overflowing.
One way you can fix this bye removing fix height and set the value height: auto; that will make the parent container automatically grow based on their child element, or you can give your ul element a class or ID and then set overflow-y: scroll; to that ID or class.
This is the code freecodecamp is using to design the middle section with the icon.
.grid {
display: flex;
}
#features .icon {
display: flex;
align-items: center;
justify-content: center;
height: 125px;
width: 20vw;
color: darkorange;
}
#features .desc {
display: flex;
flex-direction: column;
justify-content: center;
height: 125px;
width: 80vw;
padding: 5px;
}
<!-- Wrapper -->
<div class="grid">
<!-- Icon -->
<div class="icon">
<i class="fa fa-3x fa-fire"></i>
</div>
<!-- /Icon -->
<!-- Description -->
<div class="desc">
<h2>Premium Materials</h2>
<p> Our trombones use the shiniest brass which is sourced locally. This will increase the longevity of your purchase. </p>
</div>
<!-- /Description -->
</div>
<!-- /Wrapper -->
Now let me explain what is going on here. The div with the class name grid is the parent element for both icon and the desc So they set display of grid to display: flex; and give both child element fix width width: 20vw; and width: 80vw;
And I like to add one little note, That If you are using position: absolute; to any element then It's a good idea to set Its parent to position: relative; That would make working with position a lot easier.

Adjust <p> width to its text content

This seems like an easy question but I've been trying to fix it for a couple of hours now and I still cannot find a solution. I have a box with two columns like in here:
p {
margin: 0;
padding: 0;
margin-right: 2px;
}
.container {
padding: 5px;
width: 90%;
height: 200px;
margin: auto;
border: 1px black solid;
}
.row {
display: flex;
justify-content: space-between;
width: 100%;
}
.half {
width: 50%;
}
.left-col {
display: flex;
}
.right-col {
text-align: right;
}
.tooltip {
position: relative;
border: 1px black solid;
border-radius: 100%;
width: 14px;
height: 14px;
font-size: 12px;
display: flex;
justify-content: center;
align-items: center;
}
<div class="container">
<div class="row">
<div class="half">
<div class="left-col">
<p>Username picked on regitration:</p>
<div class="tooltip">?</div>
</div>
</div>
<div class="half">
<p class="right-col">
John WithLongSurname
</p>
</div>
</div>
</div>
The problem is, that when I open the page on mobiles, the text on the left column is too long and it wraps (which is good), but its width still takes a whole column, so the tooltip is not next to the text but in the center of the box (it sticks to the right side of the column). Example:
I tried to add width: min-content to the "label" class, but then the whole paragraph just collapses to the smallest possible width. How can I adjust the width of the paragraph, so it will take only as much width as it needs to, so the tooltip will always be next to it?
It is because you are using display: flex; for the .left-col class. By default it will distribute the width automatically and evenly.
Try the styling below to see if it works:
p {
margin: 0;
padding: 0;
margin-right: 2px;
}
.container {
padding: 5px;
width: 90%;
height: 200px;
margin: auto;
border: 1px black solid;
}
.row {
display: flex;
justify-content: space-between;
width: 100%;
}
.half {
width: 50%;
}
.left-col {
display: inline;
}
.right-col {
text-align: right;
}
.tooltip {
position: relative;
border: 1px black solid;
border-radius: 100%;
width: 14px;
height: 14px;
font-size: 12px;
display: inline;
}
p.label {
width: auto;
}
<div class="container">
<div class="row">
<div class="half">
<div class="left-col">
<p class="label">Username picked on regitration:
<span class="tooltip">?</span>
</p>
</div>
</div>
<div class="half">
<p class="right-col">
John WithLongSurname
</p>
</div>
</div>
</div>

Display Flex Items Align Center

I am trying to make it so the second section or the first section will align center with the top.
What I don't understand is the relationship between items with display flex vs items that have display block.
First Question: Is there a way with flex so the top logo doesn't look "off" center compared to the centered text in the second section?
Link To Pen: https://codepen.io/skella1/pen/vYZLdVN
<div class="header">
<img src="https://via.placeholder.com/100x50" alt="">
<p>Text Goes Here</p>
</div>
<div class="secHeader">
<h1>Welcome</h1>
<p>This is a page to login</p>
</div>
<div class="content">
<div class="login">
<p style="padding-right: 10px;">Login</p>
<input type="text">
<button>Login</button>
</div>
</div>
body {
margin: 0px;
padding: 0px;
}
.header {
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0px;
img {
margin: 0 auto;
}
}
.secHeader {
background-color: #ddd;
text-align: center;
display: block;
line-height: 0px;
padding: 20px;
h1 {
text-transform: uppercase;
font-weight: 900;
}
}
.content{
background: url("http://www.placebear.com/500/300") center center no-repeat;
background-size: cover;
width: 100%;
height: 100vh;
position: relative;
.login {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0px;
justify-content: center;
flex-direction: row;
align-items: center;
display: flex;
}
}
Center the image using justify-content: center on the flex parent element and then set the P elements position to absolute and position it using the top/right properties.
Right now you have two elements that are taking up space in the flex parent elements width. The image and the P tags content. Using justify-content: space-between will place the remainder of the width the elements do not use, between them. In turn skewing the look of the image from being in the center regardless of your margin set to 0 auto, as that only places it in the center of the space it takes up from the parent.
body {
margin: 0px;
padding: 0px;
}
.header {
height: 50px;
display: flex;
justify-content: center;
align-items: center;
padding: 0px;
}
.header p {
position: absolute;
top: 0;
right: 20px;
}
.secHeader {
background-color: #ddd;
text-align: center;
display: block;
line-height: 0px;
padding: 20px;
}
.secHeader h1 {
text-transform: uppercase;
font-weight: 900;
}
.content {
background: url("http://www.placebear.com/500/300") center center no-repeat;
background-size: cover;
width: 100%;
height: 100vh;
position: relative;
}
.content .login {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0px;
justify-content: center;
flex-direction: row;
align-items: center;
display: flex;
}
<div class="header">
<img src="https://via.placeholder.com/100x50" alt="">
<p>Text Goes Here</p>
</div>
<div class="secHeader">
<h1>Welcome</h1>
<p>This is a page to login</p>
</div>
<div class="content">
<div class="login">
<p style="padding-right: 10px;">Login</p>
<input type="text">
<button>Login</button>
</div>
</div>
Answer to Question 1) A really quick fix to this was using the transform property in CSS to center the image with respect to the current position
Answer to Question 2) Simply set the max-width property on the .content class to prevent the scrolling you talked about
body {
margin: 0px;
padding: 0px;
}
.header {
height: 50px;
width:100%;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0px;
img {
margin: 0 auto;
transform:translate(50%,0%); /* MODIFIED CODE HERE */
}
}
.secHeader {
background-color: #ddd;
text-align: center;
display: block;
line-height: 0px;
padding: 20px;
h1 {
text-transform: uppercase;
font-weight: 900;
}
}
.content{
background: url("http://www.placebear.com/500/300") center center no-repeat;
background-size: cover;
height: 100vh;
max-width:100vw; /* MODIFIED CODE HERE */
position: relative;
.login {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0px;
justify-content: center;
flex-direction: row;
align-items: center;
display: flex;
}
}
If you're insisting on using flexbox for the header, what you can do is the following:
<div class="header">
<div>
</div>
<div class="text-center">
<img src="https://via.placeholder.com/100x50" alt="">
</div>
<div class="text-right">
<p>Text Goes Here</p>
</div>
</div>
.header {
height: 50px;
display:flex;
padding: 0px;
justify-content: space-between;
div {
flex:1;
}
div.text-center {
text-align:center;
}
div.text-right{
text-align:right;
}
}
Please note that this is just a workaround, flexbox is not the only solution here. You might use position:absolute for this.

Is it possible to align one flex child above another flex child in a line below?

I am struggling with a flexbox tag here. I have a page header, that consists from two parts: smaller text "A comprehensive manual:" and "How to take a dog from UK to SOME OTHER COUNTRY".
So the problem is, according to design document, "How to take a dog from UK to SOME OTHER COUNTRY" should be centred, but "A comprehensive manual" line shouldn't, it should start right above letter "H" in the second line, "How to take...", as shown on a picture below:
here
Obviously, when I resize a window, flexbox starts doing it thing and wars text around, changing the position of the "How", however "A comprehensive manual" should also move to keep along.
Is it possible with a flexbox, or I should use ::after pseudoelement to achieve it? Or maybe there is better solution?
Code is below, there is also a link to the codepen with an example.
Many thanks!
<div class="take-where-box">
<div class="flex">
<div class="take-where-box__text-block large" id="take-where-box__text-block-intro"><p class="take-where-box__small-text">A Comperhensive Manual:</p></div>
<div class="take-where-box__text-block" id="take-where-box__text-block-1"><p>How to take a dog</p></div>
<div class="take-where-box__text-block" id="take-where-box__text-block-2"><p>from UK</p></div>
<div class="take-where-box__text-block" id="take-where-box__text-block-3">
<div class="select-box">
/*code for select box*/
</div> <!-- end of select-box-->
</div>
</div>
</div> <!-- take-where-box-->
Full codepen is here:
https://codepen.io/abby97/pen/oNYjrpV
Perhaps the layout can be achieved with a minor adjustment to the align-items property and a pseudo element.
.flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: flex-end; /* changed from baseline */
}
#take-where-box__text-block-1::before {
font-size: 70%;
content: "A Comprehensive Manual:";
}
#take-where-box__text-block-1::before {
font-size: 70%;
content: "A Comprehensive Manual:";
}
body,
html {
margin: 0;
padding: 0;
font-family: 'Calibri', serif;
font-size: 100%;
color: black;
background-color: var(--cyan-superdark);
}
.container {
background-color: var(--main_color);
margin: 0 auto;
width: 80%;
}
.header,
.content {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.header {
background-color: var(--yellow-main);
}
.content {
background-color: var(--cyan-superdark);
}
.take-where-box {
font-size: 3rem;
justify-content: center;
align-items: center;
font-weight: bold;
width: 90%;
border: 0.4rem solid black;
padding: 1.5rem;
}
.flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: flex-end;
}
.take-where-box__small-text {
font-size: 70%;
margin: 0;
}
.take-where-box__text-block {
flex-basis: 1;
/* flex-shrink: 0; */
/* min-width: min-content; */
padding: 0 0.5rem;
}
.large {
flex-basis: 100%;
}
.take-where-box__text-block>p {
margin: 0;
}
/*select-box - a custom select box, taken from https://www.youtube.com/watch?v=k4gzE80FKb0 */
.select-box {
display: flex;
flex-direction: column;
position: relative;
width: 22rem;
}
.select-box__selected-option,
.select-box__options-container {
border: 0.4rem solid black;
}
.select-box .select-box__options-container {
max-height: 0;
opacity: 0;
transition: all 0.3s;
/* what are other options? */
order: 1;
}
.select-box__selected-option {
margin-bottom: 8px;
position: relative;
order: 0;
}
.select-box__options-container {
position: absolute;
box-sizing: border-box;
/*otherwise border will add up to the witdh of this element making it bigger than parent, BAD!*/
width: 100%;
top: 7.5rem;
background-color: white
}
.select-box__selected-option::after {
content: "";
background: url("assets/arrow-down.svg");
background-size: contain;
background-repeat: no-repeat;
position: absolute;
height: 100%;
width: 3.0rem;
/* height: 4rem; */
right: 1rem;
top: 1rem;
transition: all 0.4s;
}
.select-box .select-box__options-container.active+.select-box__selected-option::after {
transform: rotateX(180deg);
top: -1rem;
}
.select-box .select-box__options-container.active {
max-height: min-content;
opacity: 1;
}
.select-box .select-box__option,
.select-box__selected-option {
padding: 0.5rem 1rem;
cursor: pointer;
}
.select-box .select-box__option:hover {
background-color: blue;
}
.select-box label {
cursor: pointer;
}
.select-box .select-box__option .radio {
display: none;
}
<div class="container">
<div class="take-where-box">
<div class="flex">
<div class="take-where-box__text-block large" id="take-where-box__text-block-intro">
<!--<p class="take-where-box__small-text">A Comperhensive Manual: </p>-->
</div>
<div class="take-where-box__text-block" id="take-where-box__text-block-1">
<p>How to take a dog</p>
</div>
<div class="take-where-box__text-block" id="take-where-box__text-block-2">
<p>from UK</p>
</div>
<div class="take-where-box__text-block" id="take-where-box__text-block-3">
<div class="select-box">
<div class="select-box__options-container">
<div class="select-box__option">
<input type="radio" class="radio" id="US" name="category">
<label for="US">to US</label>
</div>
<div class="select-box__option">
<input type="radio" class="radio" id="EU" name="category">
<label for="EU">to EU</label>
</div>
</div>
<!-- end of select-boxoptions-container-->
<div class="select-box__selected-option">
to US
</div>
</div>
<!-- end of select-box-->
</div>
</div>
</div>
<!-- take-where-box-->
</div>
revised codepen
i believe your code is unnecessery overcomplicated.
element positioning like in image you can achieve with this piece of code. please note that css is inline, because this is just a guidline, you can adapt it by your needs:
<div style="display:flex; align-items:center; flex-direction:column">
<div>
<div>
<p>A Comperhensive Manual:</p>
</div>
<div style="display:flex">
<p>How to take a dog from UK</p>
<p>selectbox</p>
</div>
</div>
</div>

Eliminate "padding" (visual space) with object-fit, or, how do you scale a row of images to fit a div properly?

I have a fixed-height interface I'm styling with CSS. I want it to be responsive to browser height (and, eventually, width... but one problem at a time) and I have a fiddle in which the interface operates almost exactly as I'd like it to with respect to browser height... with one exception.
I use a flexbox layout with object-fit: scale-down to force the row of images in the green div to shrink when their containing div is not tall enough to fit the images at native dimensions. This results in some "padding," the existence of which is perfectly well explained here. I've made the background color of the relevant div blue so that you can clearly see the visual space I'm talking about. I do not want this space to appear at all.
So, what is the proper way to make a row of images responsive in the way I'd like without introducing additional visual space between the images if object-fit cannot do this? Thank you for the input.
body {
font-family: arial;
font-size: 26px;
text-align: center;
color: black;
background-color: white;
}
.smallhint {
font-size: 16px;
color: #8c8c8c;
}
img {
padding: 0;
margin: 0;
font-size: 0;
display: block;
object-fit: scale-down;
min-height: 0;
}
.flex-column {
display: flex;
flex-direction: column;
padding: 0px;
margin: 0px;
height: 90vh;
flex-grow: 0;
min-width: 0;
min-height: 0;
}
.flex-row {
display: flex;
flex: 0 1.5 auto;
flex-direction: row;
justify-content: center;
align-items: center;
min-height: 0;
background-color: green;
}
.context {
display: flex;
flex-direction: column;
max-height: 100%;
background-color: blue;
}
.primary {
position: relative;
z-index: 0;
right: 0;
bottom: 0;
padding: 0;
font-size: 0;
min-height: 0;
align-items: end;
background-color: orange;
}
.primary img {
margin-left: auto;
margin-right: auto;
border-style: solid;
border-width: 3px;
border-color: black;
height: calc(100% - 2*3px);
}
.mask {
position: absolute;
z-index: 1;
top: 0;
right: 0;
width: 100%;
height: 100%;
font-size: 0;
}
.nonimage {
padding-top: 5px;
display: inline;
}
<div class="container">
<div class="flex-column">
<div class="primary">
<img src="https://via.placeholder.com/200">
<div class="mask">
<img src="https://via.placeholder.com/200/FF000">
</div>
</div>
<div class="flex-row">
<div class = "context">
<img src="https://via.placeholder.com/75x250">
</div>
<div class = "context">
<img src="https://via.placeholder.com/150x75">
</div>
</div>
<div class="nonimage">
<div class="smallhint">Some Text<br>Other Text</div>
</div>
</div>
</div>