How to make CSS apply on specific specific elements? - html

I am trying to create a timeline as the one thats shown here.
In the example the author uses the <p> tag in the CSS to display the timeline effect. When I use this code in my code. Every section where I've used a <p> tag gets the CSS effect, which I don't want.
So to avoid this I tried to use an ID I gave all of the <p> tags where I wanted the effect to show up an ID and I declared the CSS in the CSS file with the ID.
This is what I tried:
#te p {
border-top: 2px dashed;
border-color: blue !important;
margin: 0;
padding: 30px;
}
#te p:nth-child(even) {
border-left: 2px dashed;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
margin-right: 30px;
padding-right: 0;
}
#te p:nth-child(odd) {
border-right: 2px dashed;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
margin-left: 30px;
padding-left: 0;
}
#te p:first-child {
border-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
#te p:last-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
<div>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
</div>
But it did not work. The CSS didn't execute. After that I tried what was suggested in this stack overflow question. But that didn't work either.
So how do I apply this CSS to only the few <p> tags mentioned here and not any of the other <p> tags that exist somewhere else in the code?
Thank you

Your code doesn't work, because after the ID, there's a space, which will try to select a descendant of the #te, that match p.
So you have to reverse the order of these selectors, and remove the space, like:
p#te
And, IDs meant to be unique, so you should use a class instead (you can select it via . instead of #).
So, your code should look like:
p.te{
border-top: 2px dashed;
border-color: blue !important;
margin: 0;
padding: 30px;
}
p.te:nth-child(even) {
border-left: 2px dashed;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
margin-right: 30px;
padding-right: 0;
}
p.te:nth-child(odd) {
border-right: 2px dashed;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
margin-left: 30px;
padding-left: 0;
}
p.te:first-child {
border-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
p.te:last-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
<div>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
</div>

ids in HTML must be unique... use classes instead:
p.te {
border-top: 2px dashed;
border-color: blue !important;
margin: 0;
padding: 30px;
}
p.te:nth-child(even) {
border-left: 2px dashed;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
margin-right: 30px;
padding-right: 0;
}
p.te:nth-child(odd) {
border-right: 2px dashed;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
margin-left: 30px;
padding-left: 0;
}
p.te:first-child {
border-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
#te p:last-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
<div>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p class="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
</div>

The reason you're code was not working was the selectors were not used properly.
As you can see below, I slightly tweaked your code and it works fine.
Cheers.
P.S. IDs should be unique. Please use classes when targeting more than one element.
#te {
border-top: 2px dashed;
border-color: blue !important;
margin:0; padding: 30px;
}
#te:nth-child(even) {
border-left: 2px dashed;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
margin-right: 30px;
padding-right: 0;
}
#te:nth-child(odd) {
border-right: 2px dashed;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
margin-left: 30px;
padding-left: 0;
}
#te:first-child {
border-top: 0;
border-top-right-radius:0;
border-top-left-radius:0;
}
#te:last-child {
border-bottom-right-radius:0;
border-bottom-left-radius:0;
}
<div>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
<p id="te">Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, iste iusto quas eligendi corporis id eius corrupti temporibus velit? Molestias harum voluptatibus veritatis explicabo ut velit deserunt, saepe sit commodi?</p>
</div>

Related

div not displaying in browser but displaying in code editor

I'm doing the front-end on my website. I included a couple divs in my mark-up. which show on the live previewer server on vscode but when I open the very same in page in a browser these divs don't show and I don't know why cause I have not hidden them. I've set CSS but still not nothing. what's confusing is that it shows in the code editor but not on the browser.
.ad-2 {
position: relative;
top: 0px;
left: 0px;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.ad-3 {
position: absolute;
top: 0px;
left: 0px;
background-color: #010f1c;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.ad-4 {
position: absolute;
top: 201px;
left: 0px;
background-color: blue;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.ad-5 {
position: absolute;
top: 0px;
right: 0px;
background-color: chartreuse;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.ad-6 {
position: absolute;
top: 201px;
right: 0px;
background-color: chocolate;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
<div class="paragraph">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Incidunt distinctio quibusdam eum, pariatur blanditiis animi totam natus reprehenderit suscipit ut accusantium enim placeat. Hic libero esse inventore voluptatibus. Voluptas, ipsum. Lorem ipsum
dolor sit amet consectetur, adipisicing elit. Debitis, accusantium. Laboriosam saepe, doloremque cupiditate voluptatum cumque adipisci perspiciatis quas tenetur, assumenda autem ad facilis ipsum aspernatur! Laboriosam accusamus minima ducimus? Lorem
ipsum dolor sit amet consectetur adipisicing elit. Voluptate excepturi, aspernatur quasi distinctio temporibus obcaecati fugit porro? Aliquam, architecto illo sequi harum accusamus voluptatibus quasi laboriosam tempore deserunt consequuntur dolorum!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore, dicta animi! Sed doloremque voluptatibus libero optio. Itaque, debitis autem? Nam repellendus commodi laborum? Fugit praesentium minus necessitatibus, modi exercitationem quae.
</p>
<br>
<div class="ad-1"></div>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia, amet sapiente, quos labore commodi cum quas doloribus nisi minus voluptas repellat blanditiis tenetur, voluptate recusandae facere modi animi et nobis. Lorem ipsum dolor sit amet consectetur
adipisicing elit. Eius quibusdam voluptas omnis dolor voluptatibus illum, debitis quas facere rem aliquam accusamus optio voluptatum, explicabo quisquam quod laudantium unde veritatis reprehenderit! Lorem, ipsum dolor sit amet consectetur adipisicing
elit. Debitis similique beatae incidunt distinctio qui libero modi expedita molestias, illum delectus vero animi consectetur officiis unde ullam cum aspernatur id enim. Lorem, ipsum dolor sit amet consectetur adipisicing elit. A, aliquam doloribus
voluptate dignissimos cumque nisi deleniti! Facilis rerum quo, laudantium vel tenetur, numquam architecto cupiditate fuga, explicabo voluptatem at consequuntur. Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit laboriosam ullam quos veritatis
pariatur amet expedita deserunt nobis voluptatibus, eos, molestias deleniti quas. Necessitatibus odit alias nihil ratione, modi exercitationem?
</p>
<br>
<div class="ad-2"></div>
<br>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Temporibus architecto laboriosam sapiente, est eligendi amet soluta! Eius eaque distinctio aperiam voluptatem illo officiis laudantium suscipit praesentium? Aliquam excepturi laboriosam officiis?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic incidunt quo fugiat numquam enim nisi voluptas voluptates, esse mollitia, atque animi debitis illo nulla tempore provident quaerat fugit libero nemo. Lorem ipsum dolor sit amet consectetur
adipisicing elit. Dolores nobis officiis tempore provident vero ex ipsum dignissimos reiciendis, consequuntur ipsam perspiciatis reprehenderit adipisci praesentium. Assumenda autem ex quas cupiditate suscipit. Lorem ipsum dolor sit amet consectetur
adipisicing elit. Quaerat laudantium nisi accusantium exercitationem in culpa dolor laborum molestiae impedit commodi. Error debitis mollitia esse consequatur ex sunt, corrupti praesentium libero! Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Iure hic dolore tenetur iusto dolorum debitis atque facilis ipsum delectus provident, itaque molestias voluptate commodi ex! Quia tempore possimus fuga veniam!
</p>
<br>
<div class="ad-3"></div>
<div class="ad-4"></div>
<div class="ad-5"></div>
<div class="ad-6"></div>
</div>
as you can see all the ad divs have css set on them but they visible on the browser. what could be causing this.
After playing with this for a while, it seems like Chrome actually interprets the class names (ex, ad-1) as something weird. Change the names of each class.
.number2
{
position: relative;
top: 0;
left: 0;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.number3
{
position: absolute;
top: 0;
left: 0;
background-color: #010f1c;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.number4 {
position: absolute;
top: 201px;
left: 0;
background-color: blue;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.number5
{
position: absolute;
top: 0;
right: 0;
background-color: chartreuse;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
.number6
{
position: absolute;
top: 201px;
right: 0;
background-color: chocolate;
border: 2px;
border-style: solid;
color: black;
width: 200px;
height: 200px;
}
<div class="paragraph">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Incidunt distinctio quibusdam eum, pariatur blanditiis animi totam natus reprehenderit suscipit ut accusantium enim placeat. Hic libero esse inventore voluptatibus. Voluptas, ipsum.
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Debitis, accusantium. Laboriosam saepe, doloremque cupiditate voluptatum cumque adipisci perspiciatis quas tenetur, assumenda autem ad facilis ipsum aspernatur! Laboriosam accusamus minima ducimus?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptate excepturi, aspernatur quasi distinctio temporibus obcaecati fugit porro? Aliquam, architecto illo sequi harum accusamus voluptatibus quasi laboriosam tempore deserunt consequuntur dolorum!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore, dicta animi! Sed doloremque voluptatibus libero optio. Itaque, debitis autem? Nam repellendus commodi laborum? Fugit praesentium minus necessitatibus, modi exercitationem quae.
</p>
<br>
<div class="number1"></div>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia, amet sapiente, quos labore commodi cum quas doloribus nisi minus voluptas repellat blanditiis tenetur, voluptate recusandae facere modi animi et nobis.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Eius quibusdam voluptas omnis dolor voluptatibus illum, debitis quas facere rem aliquam accusamus optio voluptatum, explicabo quisquam quod laudantium unde veritatis reprehenderit!
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Debitis similique beatae incidunt distinctio qui libero modi expedita molestias, illum delectus vero animi consectetur officiis unde ullam cum aspernatur id enim.
Lorem, ipsum dolor sit amet consectetur adipisicing elit. A, aliquam doloribus voluptate dignissimos cumque nisi deleniti! Facilis rerum quo, laudantium vel tenetur, numquam architecto cupiditate fuga, explicabo voluptatem at consequuntur.
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit laboriosam ullam quos veritatis pariatur amet expedita deserunt nobis voluptatibus, eos, molestias deleniti quas. Necessitatibus odit alias nihil ratione, modi exercitationem?
</p>
<br>
<div class="number2"></div>
<br>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Temporibus architecto laboriosam sapiente, est eligendi amet soluta! Eius eaque distinctio aperiam voluptatem illo officiis laudantium suscipit praesentium? Aliquam excepturi laboriosam officiis?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic incidunt quo fugiat numquam enim nisi voluptas voluptates, esse mollitia, atque animi debitis illo nulla tempore provident quaerat fugit libero nemo.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolores nobis officiis tempore provident vero ex ipsum dignissimos reiciendis, consequuntur ipsam perspiciatis reprehenderit adipisci praesentium. Assumenda autem ex quas cupiditate suscipit.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat laudantium nisi accusantium exercitationem in culpa dolor laborum molestiae impedit commodi. Error debitis mollitia esse consequatur ex sunt, corrupti praesentium libero!
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure hic dolore tenetur iusto dolorum debitis atque facilis ipsum delectus provident, itaque molestias voluptate commodi ex! Quia tempore possimus fuga veniam!
</p>
<br>
<div class="number3"></div>
<div class="number4"></div>
<div class="number5"></div>
<div class="number6"></div>
</div>
The ad- class name triggers adblocking extensions. Do you use an adblocker? If so, it's blocking the elements from rendering. You have two fixes:
Disable your adblocker
Obviously this is not a great solution, because anyone else with an adblocker will be unable to view those divs.
Rename them
As Matthew mentioned, changing the class name to something that doesn't get blocked by adblockers will work. The Chromium rendering engine (and by extension, Chrome) isn't the one disabling the divs, it's your adblocker.

How to set height auto in Grid? [duplicate]

This question already has answers here:
CSS-only masonry layout
(4 answers)
Closed 1 year ago.
First, see the image.
How can I remove the extra space? I want to set the height of the box as per the content. How can I do it in Grid?
See the following code.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
background-color: #ddd;
padding: 10px;
/* Grid CSS */
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.container div {
border: 1px solid #000;
padding: 15px;
}
<div class="container">
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Alias ipsum consectetur quod rem dolores? Dolorem, debitis quos. Illo aliquam hic cupiditate nemo temporibus quibusdam commodi dicta quisquam, saepe laboriosam tempore minus et rem architecto
modi voluptatibus neque! Porro quibusdam itaque praesentium maxime rem deleniti est, sed dolorum reprehenderit pariatur provident.</div>
<div>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Dolorum accusantium quos dolorem esse pariatur! Illo harum voluptatibus labore obcaecati cum?</div>
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Alias ipsum consectetur quod rem dolores? Dolorem, debitis quos. Illo aliquam hic cupiditate nemo temporibus quibusdam commodi dicta quisquam, saepe laboriosam tempore minus et rem architecto
modi voluptatibus neque! Porro quibusdam itaque praesentium maxime rem deleniti est, sed dolorum reprehenderit pariatur provident.</div>
<div>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Dolorum accusantium quos dolorem esse pariatur! Illo harum voluptatibus labore obcaecati cum?</div>
</div>
I want to fill the bottom space of the top box with the below box. Is it possible in Grid?
You can use the align-items property:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
background-color: #ddd;
padding: 10px;
/* Grid CSS */
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
align-items: start;
}
.container div {
border: 1px solid #000;
padding: 15px;
}
<div class="container">
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Alias ipsum consectetur quod rem dolores? Dolorem, debitis quos. Illo aliquam hic cupiditate nemo temporibus quibusdam commodi dicta quisquam, saepe laboriosam tempore minus et rem architecto
modi voluptatibus neque! Porro quibusdam itaque praesentium maxime rem deleniti est, sed dolorum reprehenderit pariatur provident.</div>
<div>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Dolorum accusantium quos dolorem esse pariatur! Illo harum voluptatibus labore obcaecati cum?</div>
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Alias ipsum consectetur quod rem dolores? Dolorem, debitis quos. Illo aliquam hic cupiditate nemo temporibus quibusdam commodi dicta quisquam, saepe laboriosam tempore minus et rem architecto
modi voluptatibus neque! Porro quibusdam itaque praesentium maxime rem deleniti est, sed dolorum reprehenderit pariatur provident.</div>
<div>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Dolorum accusantium quos dolorem esse pariatur! Illo harum voluptatibus labore obcaecati cum?</div>
</div>

Using #media to keep nav elements in place when adjusting screen size [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
https://jsfiddle.net/5fmcdw1e/4
I am trying to make it so my nav elements "Home", "Learning", "Hobbies" don't move from their location.
I am currently using #media and just adjusting the font-size but it eventually get's too small and/or moves down when I want it to not move.
I'm sure someone smarter can help or has an idea what the best way of doing this is.
Thanks! (also i'm pretty new to css and html)
any help pointing me in the right direction is much appreciated.
<html>
<head>
<link rel="stylesheet" href="main.css">
<meta charset="utf-8">
<title>Contact Me</title>
</head>
<body>
<header class='header'>
<div class='container'>
<img class="logo-kekw" src="icons/kekw.png" alt="kekw">
<nav>
<ul>
<li>
<a href='index.html'>Home</a>
</li>
<li>
Learning
</li>
<li>
Hobbies
</li>
</ul>
</nav>
</div>
</header>
<div id="box">
<div id="box-title">
I am learning about:
</div>
<div id="content">box-models, box-sizing, margins, padding, #media, and more currently.</div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
</div>
<div id="box">
<div id="hobbies">
Hobbies:
</div>
<div id="content">Skateboarding, programming in html, css, javascript (yet to learn), python, biking, longboarding, hiking, snowboarding.</div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
</div>
<div id="container-footer">
<footer id="footer">
<ul id="ul-footer">
<li id="email">Email me</li>
<li id="instagram">Instagram</li>
<li id="kik">Kik</li>
</ul>
</footer>
</div>
</body>
</html>
h2,
h3,
h4,
h5,
h6,
p,
a,
ul,
li {
font-family: "proxima-nova", sans-serif;
}
.container {
width: 80%;
margin: 0 auto;
}
.header {
font-size: 24px;
width: 100%;
height: 100px;
background-color: rgb(18 39 45);
position: fixed;
text-align: center;
line-height: 50px;
top: 0;
left: 0;
border-bottom: 1px solid turquoise;
}
.logo-kekw:hover {
border-radius: 50%;
}
.logo-kekw {
border-radius: 50%;
border: #62b862dc solid 2px;
padding: 1.8px 1.8px;
height: 75px;
width: 75px;
float: left;
margin-top: 9px;
margin-left: 42px;
}
.header nav {
float: right;
padding-right: 35px;
line-height: 50px;
}
.header nav ul li {
list-style: none;
display: inline-block;
margin-left: 25px;
}
.header nav ul li a:hover {
transition-duration: .3s;
color: white;
}
.header nav ul li a {
text-decoration: none;
color: #f67600;
font-size: 40px;
margin-left: 10px;
margin-right: 10px;
cursor: crosshair;
}
.header.shadow {
box-shadow: 0 3px 5px rgba(57, 63, 72, 0.3);
}
body {
height: 100%;
background-color: #100e17;
margin-top: 120px;
}
#box-title {
letter-spacing: 2px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
box-sizing: border-box;
margin: 0;
font-size: 28px;
font-weight: 600;
text-align: center;
color: white;
text-transform: uppercase;
margin-bottom: 25px;
margin-top: 15px
}
#box #content {
padding: 10px;
border: 2px solid black;
}
#hobbies {
box-sizing: border-box;
letter-spacing: 2px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
font-size: 28px;
font-weight: 600;
text-align: center;
color: white;
text-transform: uppercase;
margin-bottom: 25px;
margin-top: 15px
}
#box {
background-color: rgb(94 94 125 / 50%);
padding: 10px;
border: solid 2px black;
margin: auto;
width: 75%;
height: 400px;
box-sizing: border-box;
overflow: scroll;
margin-bottom: 150px;
}
#content {
margin-top: 10px;
font-size: 16px;
background-color: #62b862dc;
text-align: center;
/*green*/
}
#footer {
font-family: "Lucida Console", Courier, monospace;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: rgb(18 36 41);
border-top: 1px solid turquoise;
text-align: center;
height: 70px;
}
#footer ul li {
display: inline;
}
#footer ul li a {
text-decoration: none;
font-size: 32px;
margin-right: 10px;
font-family: "proxima-nova", sans-serif;
padding: .2em 1em;
color: #f67600;
background-color: black;
border: 1px solid white;
}
#footer ul li a:hover {
background-color: #f67600;
transition-duration: .3s;
color: black;
border: solid 1px white;
}
/*
#email a:hover {
background-color: black;
transition-duration: .1s;
color: #ffffff;
border: solid 2px;
text-shadow: 2px 8px 6px rgba(0, 0, 0, 0.2), 0px -5px 35px rgba(255, 255, 255, 0.3);
padding-left: 3%;
padding-right: 3%;
}
*/
::-webkit-scrollbar {
width: 5px;
}
/* Track */
::-webkit-scrollbar-track {
overflow: hidden;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #1aa260;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #7a00708c;
}
#media screen and (max-width: 900px) {
body {
font-size: 32px;
}
}
#media screen and (min-width: 695px) and (max-width: 950px) {
.header nav ul li a {
font-size: 20px;
}
}
#media screen and (min-width: 633px) and (max-width: 695px) {
.header nav ul li a {
font-size: 15px;
}
}
#media screen and (min-width: 400px) and (max-width: 632px) {
.header nav ul li a {
font-size: 8px;
}
}
Over here you're applying margin-left: 25px, which will result on smaller screen that this links will jump underneath the parent because they don't have enough space. Same for the header logo you're applying margin-left: 42px. Simply take of this margin values and check your results again.
If you want to get away from this issues have a look on the flex-box or grid layouts. There're plenty of resources on internet just search.
My proposition to your problem is to keep a fixed font-size and when it is moved down, you can use responsive menu Bar, https://www.w3schools.com/howto/howto_js_topnav_responsive.asp . And that way Home, Learning and Hobbies will always remain readable.
I change a little your CSS-code (3 times /*add*/), such that you can see what I mean (resize and you will see that nav backgorund-color change from green to red)
.container {
width: 80%;
margin: 0 auto;
display: inline; /*add*/
}
.header {
font-size: 24px;
width: 100%;
height: 100px;
background-color: rgb(18 39 45);
position: fixed;
line-height: 50px;
top: 0;
left: 0;
border-bottom: 1px solid turquoise;
}
.logo-kekw:hover {
border-radius: 50%;
}
.logo-kekw {
border-radius: 50%;
border: #62b862dc solid 2px;
padding: 1.8px 1.8px;
height: 75px;
width: 75px;
float: left;
margin-top: 9px;
margin-left: 42px;
}
.header nav {
float: right;
padding-right: 35px;
line-height: 50px;
background-color: green; /*add*/
}
.header nav ul li {
list-style: none;
display: inline-block;
margin-left: 25px;
}
.header nav ul li a:hover {
transition-duration: .3s;
color: white;
}
.header nav ul li a {
text-decoration: none;
color: #f67600;
margin-left: 10px;
margin-right: 10px;
cursor: crosshair;
font-size: 30px;
}
.header.shadow {
box-shadow: 0 3px 5px rgba(57, 63, 72, 0.3);
}
body {
height: 100%;
background-color: #100e17;
margin-top: 120px;
}
#box-title {
letter-spacing: 2px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
box-sizing: border-box;
margin: 0;
font-size: 28px;
font-weight: 600;
text-align: center;
color: white;
text-transform: uppercase;
margin-bottom: 25px;
margin-top: 15px
}
#box #content {
padding: 10px;
border: 2px solid black;
}
#hobbies {
box-sizing: border-box;
letter-spacing: 2px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
font-size: 28px;
font-weight: 600;
text-align: center;
color: white;
text-transform: uppercase;
margin-bottom: 25px;
margin-top: 15px
}
#box {
background-color: rgb(94 94 125 / 50%);
padding: 10px;
border: solid 2px black;
margin: auto;
width: 75%;
height: 400px;
box-sizing: border-box;
overflow: scroll;
margin-bottom: 150px;
}
#content {
margin-top: 10px;
font-size: 16px;
background-color: #62b862dc;
text-align: center;
/*green*/
}
#footer {
font-family: "Lucida Console", Courier, monospace;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: rgb(18 36 41);
border-top: 1px solid turquoise;
text-align: center;
height: 70px;
}
#footer ul li {
display: inline;
}
#footer ul li a {
text-decoration: none;
font-size: 32px;
margin-right: 10px;
font-family: "proxima-nova", sans-serif;
padding: .2em 1em;
color: #f67600;
background-color: black;
border: 1px solid white;
}
#footer ul li a:hover {
background-color: #f67600;
transition-duration: .3s;
color: black;
border: solid 1px white;
}
/*
#email a:hover {
background-color: black;
transition-duration: .1s;
color: #ffffff;
border: solid 2px;
text-shadow: 2px 8px 6px rgba(0, 0, 0, 0.2), 0px -5px 35px rgba(255, 255, 255, 0.3);
padding-left: 3%;
padding-right: 3%;
}
*/
::-webkit-scrollbar {
width: 5px;
}
/* Track */
::-webkit-scrollbar-track {
overflow: hidden;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #1aa260;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: #7a00708c;
}
#media screen and (max-width: 900px) {
body {
font-size: 32px;
}
}
#media screen and (max-width: 660px) { /*add*/
/*responsive menu bar*/
.header nav {
background-color: red;
}
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css">
<meta charset="utf-8">
<title>Contact Me</title>
</head>
<body>
<header class='header'>
<div class='container'>
<img class="logo-kekw" src="icons/kekw.png" alt="kekw">
<nav>
<ul>
<li>
<a href='index.html'>Home</a>
</li>
<li>
Learning
</li>
<li>
Hobbies
</li>
</ul>
</nav>
</div>
</header>
<div id="box">
<div id="box-title">
I am learning about:
</div>
<div id="content">box-models, box-sizing, margins, padding, #media, and more currently.</div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
</div>
<div id="box">
<div id="hobbies">
Hobbies:
</div>
<div id="content">Skateboarding, programming in html, css, javascript (yet to learn), python, biking, longboarding, hiking, snowboarding.</div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
<div id="content"> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Et aliquid esse perspiciatis itaque est placeat tempora libero, inventore iure quam, cupiditate, recusandae optio ex fugit! Expedita ratione voluptatem repellendus nisi? Lorem ipsum dolor
sit amet consectetur adipisicing elit. Eligendi harum laboriosam velit esse, labore repellendus asperiores aliquid? Quas odio dolores quia accusantium, sed magnam possimus optio veritatis assumenda ratione unde! </div>
</div>
<div id="container-footer">
<footer id="footer">
<ul id="ul-footer">
<li id="email">Email me</li>
<li id="instagram">Instagram</li>
<li id="kik">Kik</li>
</ul>
</footer>
</div>
</body>
</html>
just a few changes to your code will bring you a little bit further to what you want:
.header nav {
float: right;
line-height: 50px;
}
Remove padding here because you have a div around with width 80%, that's enougth.
ul {
display: inline-flex;
}
This will prevent you list items from wrapping around.
#media screen and (max-width: 400px) {
.container, ul {
display: flex;
flex-flow: column wrap;
}
}
Add media query to handle smallest screens.
From here it's up to you to make further improvements. Follow advice of #codeHysteria and have a look into flexbox css. This will help you to get a simple and clean page grid. For more complex grids use css-grid.

Order first div behind second one

I wonder if there is possible to set the first div behind the second one without use jquery or flex box.
Is there any way ?
.container {}
.one {
background-color: #FF0004;
float: right;
}
.two {
background-color: #000DFF;
float: left;
}
<body>
<div class="container">
<div class="one">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos vitae nihil facere repudiandae voluptatem corporis tempore quasi? A quo aspernatur odit expedita cum maxime, alias quis. Laudantium quaerat voluptatem quo.</div>
<div class="two">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro, eos. Quas nihil tenetur suscipit asperiores obcaecati fuga, id, quis dolor quisquam explicabo modi optio unde! Quas atque eius, numquam aliquam.</div>
</div>
</body>
Thank you !
Give parent div position:relative and position:absolute to child div.
Now you can handle the position of div using top:10px and left:10px.
.container {
position:relative;
}
.one {
background-color: #FF0004;
float: right;
}
.two {
background-color: #000DFF;
float: left;
position:absolute;
top:10px;
left:10px;
}
<div class="container">
<div class="one">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos vitae nihil facere repudiandae voluptatem corporis tempore quasi? A quo aspernatur odit expedita cum maxime, alias quis. Laudantium quaerat voluptatem quo.</div>
<div class="two">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro, eos. Quas nihil tenetur suscipit asperiores obcaecati fuga, id, quis dolor quisquam explicabo modi optio unde! Quas atque eius, numquam aliquam.</div>
</div>
you can use z-index
.container {}
.one {
background-color: #FF0004;
position: absolute;
left: 5px;
top: 5px;
z-index: -1;
}
.two {
background-color: #000DFF;
}
<div class="container">
<div class="one">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dignissimos vitae nihil facere repudiandae voluptatem corporis tempore quasi? A quo aspernatur odit expedita cum maxime, alias quis. Laudantium quaerat voluptatem quo.</div>
<div class="two">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro, eos. Quas nihil tenetur suscipit asperiores obcaecati fuga, id, quis dolor quisquam explicabo modi optio unde! Quas atque eius, numquam aliquam.</div>
</div>

How to have two different custom scrollbar on one page?

So what I am trying to have is a different scrollbar for the scrollable div and a different one for the whole window. This is what I have tried to do but I haven't been able to get two different colour scroll bar.
*{
margin: 0;
padding: 0;
font-family: 'segoe ui light';
}
header{
width: 100%;
height: 300px;
background: #efefef;
}
.container{
width: 90%;
margin: auto;
}
h1{
padding: 20px 0;
font-size: 45px;
font-family: 'segoe ui light';
text-align: center;
}
h2{
font-size: 35px;
padding: 10px 0 20px 20px;
}
figure{
top: 0;
width: 400px;
height: 500px;
padding: 0px 0px 0px 125px;
}
img{
width: 100%;
height: 100%;
}
.section{
padding: 50px 0;
height: 500px;
-webkit-column-count: 2;
-webkit-column-gap:20px;
}
.intro{
font-weight: 1000;
}
.content{
max-height: 250px;
overflow-y: scroll;
overflow-x:hidden;
}
/******************SCROLL BAR***********************/
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
opacity: 0;
background-color: #d2edda;
//-border-radius: 10px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: #0b602f;
}
::selection {
color: white;
background: #13DA69;
}
<html>
<head>
<link rel="stylesheet" href="..//css/interview.css">
</head>
<body>
<header></header>
<div class="container">
<h1>INTERVIEW</h1>
<div class="section one">
<h2>Name</h2>
<div class="intro">
<b> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus laboriosam quia, dolores impedit autem consequuntur eaque sed harum adipisci quos voluptas, maxime ducimus nemo id et excepturi temporibus, <br>perspiciatis reprehenderit.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem sed aut dolore magni corrupti. Debitis minus officiis magni, laborum! Unde impedit similique delectus voluptatibus necessitatibus a atque, debitis dolores nulla.</b>
</div>
<br>
<br>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
</div>
<figure>
<img src="" alt="insert img here">
</figure>
</div>
</div>
</body>
</html>
So a different scrollbar for the div and a different scrollbar for the window is required.
Just like with any CSS selector, you simply need to apply the various ::-webkit-scrollbar pseudo-elements to the div element itself by specifying this within the selector:
/* This styles any scrollbar. */
::-webkit-scrollbar {
...
}
/* This styles any scrollbar which is part of a `div` element. */
div::-webkit-scrollbar {
...
}
*{
margin: 0;
padding: 0;
font-family: 'segoe ui light';
}
header{
width: 100%;
height: 300px;
background: #efefef;
}
.container{
width: 90%;
margin: auto;
}
h1{
padding: 20px 0;
font-size: 45px;
font-family: 'segoe ui light';
text-align: center;
}
h2{
font-size: 35px;
padding: 10px 0 20px 20px;
}
figure{
top: 0;
width: 400px;
height: 500px;
padding: 0px 0px 0px 125px;
}
img{
width: 100%;
height: 100%;
}
.section{
padding: 50px 0;
height: 500px;
-webkit-column-count: 2;
-webkit-column-gap:20px;
}
.intro{
font-weight: 1000;
}
.content{
max-height: 250px;
overflow-y: scroll;
overflow-x:hidden;
}
/******************SCROLL BAR***********************/
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
opacity: 0;
background-color: #d2edda;
//-border-radius: 10px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: #0b602f;
}
div::-webkit-scrollbar-track {
background-color: red;
}
div::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
background: purple;
}
::selection {
color: white;
background: #13DA69;
}
<html>
<head>
<link rel="stylesheet" href="..//css/interview.css">
</head>
<body>
<header></header>
<div class="container">
<h1>INTERVIEW</h1>
<div class="section one">
<h2>Name</h2>
<div class="intro">
<b> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus laboriosam quia, dolores impedit autem consequuntur eaque sed harum adipisci quos voluptas, maxime ducimus nemo id et excepturi temporibus, <br>perspiciatis reprehenderit.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem sed aut dolore magni corrupti. Debitis minus officiis magni, laborum! Unde impedit similique delectus voluptatibus necessitatibus a atque, debitis dolores nulla.</b>
</div>
<br>
<br>
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi laboriosam enim maiores placeat, ullam explicabo magnam. Quam repudiandae fugiat, incidunt explicabo quis amet cupiditate quos dolores tempore maxime distinctio inventore.
<br>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate debitis, a saepe eius laboriosam hic incidunt eum ipsam fugiat necessitatibus modi accusantium dignissimos doloribus, adipisci voluptas alias harum molestias officia!</p>
</div>
<figure>
<img src="" alt="insert img here">
</figure>
</div>
</div>
</body>
</html>