A button is inside the navigation bar, but the btn doesnt belong in the div class of the nav bar - html

So I made a post similar to this one, since I didn't get a precise answer and didn't understand the instructions. So I am once again asking for your support.
There are a couple of issues regarding my nav bar that I am unable to fix. One of them is a button sticking inside of the nav bar, but it doesn't even belong in the div class.
Navigation Bar
The second issue is that I can't line the logo/text [SINUS] and the links together in one line.
Any help would be appreciated!
/*====================
The CSS File
Section 1:
Buttons
=====================*/
button {
background-color: #358cf0;
border: none;
border-radius: 18px;
text-align: center;
text-decoration: none;
opacity: 0.8;
font-size: 14px;
color: rgb(255, 255, 255);
padding: 12px 48px;
transition: 0.3s;
outline: none;
}
button:hover {
opacity: 1;
}
ul li {
display: inline-block;
padding: 10px;
font-size: 20px;
font-family: raleway;
}
ul li:hover {
color: orange;
}
/*====================
The CSS File
Section 2:
Alerts
=====================*/
.container {
position: fixed;
top: 74%;
right: 0;
left: 77%;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
font-family: basic;
}
.modal {
width: 40%;
min-width: 20rem;
background-color: #ffffff;
border-radius: 12px;
}
.modal-header {
display: flex;
align-items: center;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
background-color: #358cf0;
padding: 8px 10px;
color: #fff;
font-size: 110%;
font-weight: 600;
font-family: basic;
}
.modal-content {
padding: 1rem;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.modal-footer {
text-align: center;
}
/*====================
The CSS File
Section 3:
Body etc.
=====================*/
body {
background-color: #252036;
}
#navigation-container {
width: 1200px;
margin: 0 auto;
height: 70%;
}
.navigation-bar {
background-color: #1c172c;
position: fixed;
width: 100%;
left: 0;
top: 0;
text-align: right;
}
.navigation-bar ul {
padding: 0px;
margin: 0px;
text-align: right;
display: inline-block;
vertical-align: top;
}
.navigation-bar li {
list-style-type: none;
padding: 0px;
display: inline;
text-align: right;
}
.navigation-bar li a {
color: black;
font-size: 16px;
font-family: basic;
text-decoration: none;
line-height: 70px;
padding: 5px 15px;
opacity: 0.7;
}
#menu {
float: right;
}
/*====================
The CSS File
Section 4:
Text
=====================*/
#font-face {
font-family: basic;
src: url(Helmet-Regular.ttf);
}
h1 {
font-family: basic;
color: white;
font-size: 390%;
text-align: left;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="sccp.css">
<title>Sinus - 【Home】</title>
<link rel="icon" href="titl.ico">
<link rel="apple-touch-icon" href="titl.ico" />
</head>
<body>
<div class="navigation-bar">
<div id="navigation-container">
<h1>SINUS</h1>
<ul>
<li>Home</li>
</ul>
</div>
</div>
<button>Download</button>
<div class="container" role="alert">
<div class="modal">
<div class="modal-header">
UPDATE! Sinus 1.0v
</div>
<div class="modal-content">
Here new stuff go gogogo
<br>Read more...
</div>
<div class="modal-footer">
</div>
</div>
</div>
</body>
</html>

To align the logo and links, use flex on the #navigation-container:
#navigation-container {
display: flex;
justify-content: space-between;
align-items: center;
}
justify-content: space-between will put the maximum space between the contents - in this case your logo and ul that contain the links. align-items:center lines them up vertically.
https://codepen.io/doughballs/pen/RwPrYoX
Not sure what your issue with the button is but because your nav has position:fixed, it is being taken out of the flow of the page, so the button doesn't 'know' it is there. If you wanted it to sit under the nav, you need to add a container with margin-top to push it down. But I'm not sure what your issue is with it, clarify and I'll amend the codepen.

Related

The left side bar is being pushed to the right

I just made my website header and now I'm trying to build the side bar, however instead of sticking to the left, it's being pushed to the right and I don't know why... but I guess it's because of the float elements that I added in the header? I've tried setting the margins to 0, floating it to the left, and nothing works.
Here's the code:
body {
font-size: 62.5%;
}
:root {
--color-primary: #b22222;
}
/* Box */
#box {
margin: 2% 20%;
}
/* Header */
#header {
background-color: var(--color-primary);
width: 100%;
height: 100px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.oldenhook_icon {
height: 90px;
width: 90px;
margin-left: 15px;
float: left;
}
.header_h1 {
color: #800000;
font-family: "Noto Sans Mono", monospace;
font-size: 2.5rem;
font-weight: 900;
display: inline-block;
margin-left: 30%;
margin-bottom: 0;
}
.flexbox {
display: flex;
flex-direction: row;
float: right;
list-style-type: none;
margin-right: 22%;
}
.list-item {
color: #fff;
padding-left: 5px;
text-decoration: none;
font-size: 12px;
font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
}
/* Search box */
#searchbox {
top: 40px;
position: relative;
}
<div id="box">
<div id="header">
<i
><img
class="oldenhook_icon"
src="icons/icon2.png"
alt="The Oldenhook Icon"
/></i>
<div>
<h1 class="header_h1">[ oldenhook ]</h1>
<ul class="flexbox">
home
search
global
social net
invite
faq
logout
</ul>
</div>
<div id="searchbox">
<label for="email">Email:</label>
<input name="email" id="email" type="text">
<p>oifjqoifjq</p>
<p>ofijqofiqjf</p>
</div>
</div>
Your code is fine just remove float: right; from class flexbox in css
I think you can add position: absolute; to class .flexbox{}

scroll-snap doesn't snap correctly

I am working on a personal project and i use scroll-snap in this project
but for some reason the scroll snap sometimes overshoots or lands at an awkward position between 2 parts of the page
#import url('https://fonts.googleapis.com/css2?family=Roboto:wght#100&display=swap');
#import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght#600&display=swap');
:root {
--bg-color: rgb(33, 32, 41);
--header-color: rgb(255, 170, 55);
--color-white: white;
--color-black: black;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
scroll-behavior: smooth;
}
html{
scroll-snap-type: y mandatory;
}
html, body {
font-family: 'Titillium Web', sans-serif;
background-color: var(--bg-color);
color: var(--color-white);
width: 100%;
}
body div {
scroll-snap-align: start;
}
header {
background: var(--header-color);
position: fixed;
top: 0;
z-index: 10000;
width: 100%;
}
header div {
width: 80%;
margin: 0 auto;
}
header div::after {
content: '';
display: table;
clear: both;
}
header div img {
position: absolute;
float: left;
margin: 0.6em;
}
nav ul {
width: auto;
float: right;
margin: 2em;
}
nav ul li {
display: inline-block;
margin-left: 2em;
font-family: 'Roboto', sans-serif;
}
nav ul li a {
font-size: 1.5em;
color: black;
text-decoration: none;
text-transform: uppercase;
}
nav ul li a:hover {
color: rgb(93, 93, 93);
}
#about {
display: flex;
justify-content: center;
align-items: center;
width: clamp(750px, 80%, 100%);
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
}
#about p {
display: inline;
color: var(--header-color);
}
#about h1 {
margin-bottom: 1em;
}
#invite {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
background-color: var(--header-color);
color: var(--color-black);
}
#invite div {
width: clamp(750px, 80%, 100%);
}
#invite div h1 {
margin-bottom: 2em;
}
#invite div button {
width: 6em;
height: 3em;
background-color: rgba(0, 0, 0, 0);
color: var(--color-black);
font-size: 1em;
font-family: 'Roboto', sans-serif;
text-transform: uppercase;
border: 1px solid black;
transition: 0.2s;
}
#invite button:hover {
margin-top: 0.3em;
}
#invite button a {
color: var(--color-black);
text-decoration: none;
}
#contact {
display: flex;
justify-content: center;
align-items: center;
width: clamp(750px, 80%, 100%);
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
}
#contact div h1 {
margin-bottom: 1em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FoxoBot</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div>
<img src="files/logo.png" alt="Logo" height="72em">
<nav>
<ul>
<li>About</li>
<!--<li>showcase</li>-->
<li>Invite</li>
<li>contact</li>
</ul>
</nav>
</div>
</header>
<div id="about">
<div>
<h1>About</h1>
<p><p>FoxoBot</p> is a Discord bot developed by Lappland and Ralkey.</p>
<br>
<p><p>FoxoBot</p> is a easy to use and a friendly bot for general, fun & administrative commands on Discord</p>
<br>
<p><p>FoxoBot</p> is always in development and we also learn alot along the way</p>
</div>
</div>
<!--<div id="showcase">
-- i dont have anything for showcase yet --
</div>-->
<div id="invite">
<div>
<h1>Invite FoxoBot to your server</h1>
<button>Invite!</button>
</div>
</div>
<div id="contact">
<div>
<h1>Contact us</h1>
<p>you can contact us throught Discord.</p>
<p>our tags are:</p>
<p>Ralkey: blank</p>
<p>Lappland: blank</p>
</div>
</div>
</body>
</html>
(I recommend opening the snippet in full page)
after countless amounts of time searching for a solution I have given up and landed here
I hope atleast one of you is able to help me
It appears your problem is that you're applying scroll-snap-align: start; to every div within body and so when you scroll it is snapping to each div in your page. Whereas you only want to be applying it to its first child of the body or in your case each section of your page.
So all I have done in the example below is changed body div to body > div in your css.
You can see more information on the greater than sign in css here: What does the ">" (greater-than sign) CSS selector mean?
#import url('https://fonts.googleapis.com/css2?family=Roboto:wght#100&display=swap');
#import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght#600&display=swap');
:root {
--bg-color: rgb(33, 32, 41);
--header-color: rgb(255, 170, 55);
--color-white: white;
--color-black: black;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
scroll-behavior: smooth;
}
html{
scroll-snap-type: y mandatory;
}
html, body {
font-family: 'Titillium Web', sans-serif;
background-color: var(--bg-color);
color: var(--color-white);
width: 100%;
}
body > div {
scroll-snap-align: start;
}
header {
background: var(--header-color);
position: fixed;
top: 0;
z-index: 10000;
width: 100%;
}
header div {
width: 80%;
margin: 0 auto;
}
header div::after {
content: '';
display: table;
clear: both;
}
header div img {
position: absolute;
float: left;
margin: 0.6em;
}
nav ul {
width: auto;
float: right;
margin: 2em;
}
nav ul li {
display: inline-block;
margin-left: 2em;
font-family: 'Roboto', sans-serif;
}
nav ul li a {
font-size: 1.5em;
color: black;
text-decoration: none;
text-transform: uppercase;
}
nav ul li a:hover {
color: rgb(93, 93, 93);
}
#about {
display: flex;
justify-content: center;
align-items: center;
width: clamp(750px, 80%, 100%);
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
}
#about p {
display: inline;
color: var(--header-color);
}
#about h1 {
margin-bottom: 1em;
}
#invite {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
background-color: var(--header-color);
color: var(--color-black);
}
#invite div {
width: clamp(750px, 80%, 100%);
}
#invite div h1 {
margin-bottom: 2em;
}
#invite div button {
width: 6em;
height: 3em;
background-color: rgba(0, 0, 0, 0);
color: var(--color-black);
font-size: 1em;
font-family: 'Roboto', sans-serif;
text-transform: uppercase;
border: 1px solid black;
transition: 0.2s;
}
#invite button:hover {
margin-top: 0.3em;
}
#invite button a {
color: var(--color-black);
text-decoration: none;
}
#contact {
display: flex;
justify-content: center;
align-items: center;
width: clamp(750px, 80%, 100%);
height: 100vh;
margin: 0 auto;
text-align: center;
font-size: 1.5em;
}
#contact div h1 {
margin-bottom: 1em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FoxoBot</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div>
<img src="files/logo.png" alt="Logo" height="72em">
<nav>
<ul>
<li>About</li>
<!--<li>showcase</li>-->
<li>Invite</li>
<li>contact</li>
</ul>
</nav>
</div>
</header>
<div id="about">
<div>
<h1>About</h1>
<p><p>FoxoBot</p> is a Discord bot developed by Lappland and Ralkey.</p>
<br>
<p><p>FoxoBot</p> is a easy to use and a friendly bot for general, fun & administrative commands on Discord</p>
<br>
<p><p>FoxoBot</p> is always in development and we also learn alot along the way</p>
</div>
</div>
<!--<div id="showcase">
-- i dont have anything for showcase yet --
</div>-->
<div id="invite">
<div>
<h1>Invite FoxoBot to your server</h1>
<button>Invite!</button>
</div>
</div>
<div id="contact">
<div>
<h1>Contact us</h1>
<p>you can contact us throught Discord.</p>
<p>our tags are:</p>
<p>Ralkey: blank</p>
<p>Lappland: blank</p>
</div>
</div>
</body>
</html>

Text not responsive and white patch on right side of website

I'm building my first proper website from stratch and I've been using some of your responses which have been really helpful so thanks to everyone :)
I just have a question, but will probably have more in the future.
I would like the website to be responsive and I already put the viewpoint code, however the text itself is not responsive and due to this, when you reduce the size of the screen there is a white patch at the right side of the page that shouldnt be there. I was wondering if anyone could help me find out whats wrong with my code.
Thanks!
/* Text properties */
body {
font-family: 'Futura', sans-serif;
margin: 0;
padding: 0;
font-size: 10px;
}
h1 {
position: relative;
left:70vw;
top:30vh;
text-align: right;
font-size: 3em;
color: white
}
h2 {
font-family: 'Roboto', sans-serif;
position: relative;
left:70vw;
top:28vh;
text-align: right;
font-size: 2em;
color: white
}
h3 {
position: relative;
left:70vw;
top:28vh;
text-align: right;
font-size: 14px;
color: white
}
h4 {
position: relative;
font-family: 'Arial';
left:70vw;
top:27vh;
text-align: right;
font-size: 14px;
color: white
}
a {
color: #FFFFFF;
}
p {
margin: 0;
padding: 0;
}
.bg {
/* The image used */
background-image: url("https://eskipaper.com/images/dark-background-4.jpg");
/* Full height */
height: 96vh;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
#title
{
position: absolute;
}
.footer p
{
padding-top: 6px;
font-size: 12px;
}
.footer {
margin: 0px;
Height:30px;
width:100%;
background-color: black;
color: white;
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght#300&display=swap" rel="stylesheet">
<link href="C:\Users\Tola\Documents\Tola Photography\Landing Page\style.css" rel="stylesheet">
<title>Tola Akindipe</title>
</head>
<body>
<div class="bg">
<div id="title">
<h1>Tola Akindipe</h1>
<h2>Photography</h2>
<h3><a href="/TolaMobile"style="text-decoration: none;" >Mobile Portfolio </a> <a href="/TolaDSLR"style="text-decoration: none;" > DSLR Portfolio</a></h3>
<h4><a href="/contact" style="text-decoration: none;" >Contact</a></h4>
</div>
</div>
<div class="footer">
<p>Copyright 2020 # Tola Akindipe - All Rights Reserved</p>
</div>
</body>
</html>
Try to change your CSS to this:
/* Text properties */
body {
font-family: 'Futura', sans-serif;
margin: 0;
padding: 0;
font-size: 10px;
height: 100%;
width: 100%;
}
h1 {
text-align: right;
font-size: 3em;
color: white
}
h2 {
font-family: 'Roboto', sans-serif;
text-align: right;
font-size: 2em;
color: white
}
h3 {
text-align: right;
font-size: 14px;
color: white
}
h4 {
font-family: 'Arial';
text-align: right;
font-size: 14px;
color: white
}
a {
color: #FFFFFF;
}
p {
margin: 0;
padding: 0;
}
.bg {
/* The image used */
background: url("https://eskipaper.com/images/dark-background-4.jpg") center center no-repeat;
/* Screen Height - Footer Height */
height: calc(100vh - 30px);
/* Set The Background Size */
background-size: cover;
/* Align The Content To The Center */
display: flex;
justify-content: center;
align-items: center;
}
.footer p {
padding-top: 6px;
font-size: 12px;
}
.footer {
margin: 0px;
Height: 30px;
width: 100%;
background-color: black;
color: white;
text-align: center;
}

Why is there white space at the bottom of my web page when run in the browser?

When I run my code in the browser, I have this little line of white space at the bottom of the page. I’ve been trying different solutions but can’t seem to find one that works. Below is the home.html page. Maybe someone here can shed some light into the problem.
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="cooper, scooper, dog, pop, pick, up>
<meta name="author" content="primarysnail">
<meta name="viewport" content="width=device-width">
<meta name="description" content="connecting clients in need of dog pick pick up srvice with scoopers who will come to the client and scoop the poop">
<title>CoopersScoopers || Home</title>
<link rel="stylesheet" type="text/css" href="../CSS/style.css">
</head>
<body>
<header> <!-- company name top left; nav bar top right -->
<div class="container">
<div class="branding">
<h1><span>cooper</span>Scoopers</h1>
</div>
<nav>
<ul>
<li class="current">Home</li>
<li>Contact Us</li>
<li>Find a Scooper</li>
</ul>
</nav>
</div>
</header>
<section class="showcase"> <!-- showcase section; button to find scooper (./find.html) -->
<div class="container">
<h1>Leave the</h1>
<br>
<h1>Poo to the</h1>
<br>
<h1>Professionals.</h1>
<button type="button">Connect With a Scooper Today</button>
</div>
</section>
<section class="info-bar"> <!-- info bar; shows scooper process in 3 sections -->
<div class="container">
<div class="box">
<img src="../images/poop.jpg">
<h3>Connect With a Local Scooper</h3>
</div>
<div class="box">
<img src="../images/location.jpg">
<h3>Mark Your Poo</h3>
</div>
<div class="box">
<img src="../images/calendar.jpg">
<h3>Schedule Future Scoops</h3>
</div>
</div>
</section>
<section class="testimonials">
<div class="container">
<h1>Come Experience the Joy of a Poop-Free Life.</h1>
</section>
</body>
<footer>
<p>Copyright © primarySnail//</p>
</footer>
</html>
Here is the linked style.css file:
body {
font-family: Tahoma, Verdana, Segoe;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #ffffff;
}
/* global */
.container {
margin: auto;
width: 80%;
overflow: hidden;
}
ul {
margin: 0;
padding: 0;
}
button {
height: 50px;
background-color: #ffff00;
opacity: 0.8;
border: none;
padding-right: 30px;
padding-left: 30px;
float: left;
margin-top: -20px;
float: right;
}
button a {
text-decoration: none;
color: #4b0082;
font-weight: bold;
font-size: 25px;
}
/* header */
header {
padding-top: 30px;
min-height: 70px;
border-bottom: 4px solid #f0e68c;
background-color: #ffffff;
color: #8a2be2;
font-size: 10px;
}
header a {
text-decoration: none;
}
nav a {
color: #8a2be2;
text-decoration: none;
text-transform: uppercase;
font-size: 10px;
}
header span {
font-size: 15px;
}
header li {
float: left;
display: inline;
padding: 0px 10px 0px 10px;
}
.branding {
float: left;
}
.branding h1 {
margin: 0;
padding: 0px 10px 0px 10px;
border: 4px solid #8a2be2;
}
header nav {
float: right;
margin-top: 10px;
}
header .current {
border: 1px solid #999;
background-color: #8a2be2;
border-collapse: collapse;
}
header .current a {
color: #ffffff;
font-weight: bold;
}
/* showcase */
.showcase {
background-color: #8a2be2;
color: #ffffff;
text-align: left;
min-height: 200px;
border-bottom: 4px solid #f0e68c;
}
.showcase h1 {
font-size: 55px;
margin-top: 0;
margin-bottom: 0;
padding: 0px;
display: inline-block;
}
/* info bar*/
.info-bar {
margin-top: 20px;
border-bottom: 4px solid #f0e68c;
}
.info-bar .box {
float: left;
width: 30%;
padding: 10px;
text-align: center;
}
.info-bar .box img {
width: 90px;
height: 90px;
}
/* testimonials */
.testimonials {
background-color: #8a2be2;
color: #ffffff;
}
.testimonials h1 {
text-align: center;
}
/* footer */
footer {
background-color: #f0e68c;
margin-top: 0px;
padding: 5px;
text-align: center;
color: black;
opacity: 0.6;
}
I cannot for the life of me figure out why that little line of white space is in there at the very bottom. screenshot
Yes, I have observed white space showing in the bottom. It is because the elements inside body tag is not occupying the full available body size.
elemets heights are as
body- 722
header- 104
.showcase- 251enter code here
.info-bar- 201
.testimonials- ~71
footer- ~62
the white space in the botom is remaining area of viewport. If you make the browser smaller the white space will go away.
To fix this proble you can use below css to the body.
body {
font-family: Tahoma, Verdana, Segoe;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #ffffff;
/* Add below lines*/
display: flex;
flex-direction: column;
align-items: stretch;
}

How to set max-width for DIV contents but not the DIV itself?

UPDATE: Here's a Fiddle: https://jsfiddle.net/720v4zdy/8/
I'm customizing a tumblr blog to match someone's site and it's almost in good shape. We started with a theme that already matched it closely and then made some changes in CSS.
The last problem I can't solve is how to make the navigation bar stretch the entire page while containing all of the links in a max-width of 1024px.
Here's the tumblr blog WIP: http://craftysheepblog.tumblr.com/
I want the navigation bar to stretch the entire page, but the links to be contained with a max-width of 1024px. The trouble here is I only have one DIV to do this with, so I'm not quite sure how to make it happen.
I'm using this currently, which works somewhat. It gets ugly when you make the browser window smaller though.
#top nav {
background-color: rgb(45, 50, 51);
color: white;
text-align: left;
padding: 11px 22%;
margin-top: 20px;
width: 100%;
}
You can set the nav to max width: 1024px and fill the "gaps" on the sides with ::before and ::after pseudo elements. You'll need to hide the overflow on header#top to avoid sideways scrolling, because the pseudo elements are set wider than the content.
This does rely on you setting the height of your nav and following suit with the <a> (height, line-height, etc.) ...
Also - tweak some more; there is a 600px break point in your CSS on the live site that will interfere with this (along with a lot of your extra CSS that I didn't clean up).
body {
color: rgb(38, 39, 43);
font-family: "Open Sans", "sans-serif", Arial;
font-weight: 300;
font-size: 14px;
line-height: 1.42857143;
margin: 0;
}
#top {
overflow: hidden;
}
#top .title {
font-family: "Open Sans", "sans-serif", Arial;
font-size: 30px;
text-align: left;
font-weight: lighter;
margin-top: 18px;
display: block;
width: 100%;
max-width: 1024px;
margin-left: auto;
margin-right: auto;
}
#top nav {
background-color: rgb(45, 50, 51);
color: white;
text-align: left;
max-width: 1024px;
margin: 50px auto 20px;
height: 50px;
width: 100%;
border-width: 0;
padding: 0;
position: relative;
}
#top nav::before{
background: rgb(45,50,51);
content: "";
display: block;
position: absolute;
height: 50px;
width: 100%;
right: 100%;
}
#top nav::after{
background: rgb(45,50,51);
content: "";
display: block;
position: absolute;
height: 50px;
width: 100%;
left: 100%;
top: 0;
}
#top nav a {
border-bottom: 1px solid rgba(255, 255, 255, 0);
font-size: 13px;
letter-spacing: 1px;
font-weight: 600;
margin: 0px 15px;
}
#top nav a {
color: #fff;
font-size: 13px;
text-transform: none;
font-family: "Open Sans", "sans-serif", Arial;
font-weight: 300;
border: 0;
display: inline-block;
padding: 0 1em;
margin: 0;
height: 50px;
line-height: 50px;
}
#top nav a:hover {
color: #52A708;
}
#top .headimg {
display: none;
}
<header id="top">
<div class="row">
<div class="small-12 small-centered columns">
<a href="/" class="active">
<div class="title">Page Title</div>
</a>
<nav>
<a class="page" href="#">Link 1</a><a class="page" href="#">Link 2</a><a class="page" href="#">Link 3</a>
</nav>
</div>
</div>
</header>
How about using max-width: 1024px;
The best way to do this is to use a ul inside of a div as your navigation bar. The ul can contain all of your links. That way, the div can have a width that spans the entire page while the unordered list has a max width of 1024px.
Example code:
<html>
<head>
<style>
#nav {
width: 100%;
height: 20%;
}
#nav-links {
max-width: 1024px;
}
</style>
</head>
<body>
<div id="nav">
<ul id="nav-links">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>...</li>
</ul>
</div>
</body>
</html>
Then you can style your ul as a nav bar however you like. Here's a good link for that: http://www.w3schools.com/css/css_navbar.asp
With the amount of information you have shared it is hard to say. Obviously the cleanest way to accomplish this is to insert another element (div or otherwise) around these child elements, and assign it a max-width... however this does not sound as if it is an option for you?
If you know how many elements you want to make up the 1024px, you could assign their widths manually (i.e. give each of the four children a width of 256px, or something similar).
If you do not know any of these things, and your options for the space are limited, Javascript is your best option. You could write a script that counts the children, and either assigns their widths appropriately or inserts clears at the proper location.
If you expand your question to target a specific approach, I'm sure myself and the many gurus on here will be able to give you more specific guidance.
Use flexbox: https://philipwalton.github.io/solved-by-flexbox/
The links should stretch as normal but start to shrink when they each exceed 341px which is 1023px as a total width.
Note: Snippet best viewed in Full Page mode.
Relevant CSS
#top nav {
background-color: rgb(45, 50, 51);
color: white;
text-align: left;
padding: 11px 22%;
margin-top: 20px;
display: flex;
flex-flow: row nowrap;
justify-content: baseline;
#top nav a {
border-bottom: 1px solid rgba(255, 255, 255, 0);
font-size: 13px;
letter-spacing: 1px;
font-weight: 600;
margin: 0px 15px;
flex: 0 1 341px;
}
body {
color: rgb(38, 39, 43);
font-family: "Open Sans", "sans-serif", Arial;
font-weight: 300;
font-size: 14px;
line-height: 1.42857143;
}
.row {
max-width: 100%;
}
#top {
margin-top: 0px;
}
#top .title {
font-family: "Open Sans", "sans-serif", Arial;
font-size: 30px;
text-align: left;
font-weight: lighter;
margin-top: 18px;
display: block;
width: 100%;
max-width: 1024px;
margin-left: auto;
margin-right: auto;
}
#top nav {
background-color: rgb(45, 50, 51);
color: white;
text-align: left;
padding: 11px 22%;
margin-top: 20px;
display: flex;
flex-flow: row nowrap;
justify-content: baseline;
}
#top nav a {
border-bottom: 1px solid rgba(255, 255, 255, 0);
font-size: 13px;
letter-spacing: 1px;
font-weight: 600;
margin: 0px 15px;
flex: 0 1 341px;
}
#top nav a {
color: #fff;
font-size: 13px;
text-transform: none;
text-decoration: none;
font-family: "Open Sans", "sans-serif", Arial;
font-weight: 300;
}
#top nav a:hover {
color: #52A708;
}
#top .headimg {
display: none;
}
#posts {
width: 100%;
max-width: 1024px;
margin-left: auto;
margin-right: auto;
}
.column,
.columns {
padding: 0;
}
#posts article:nth-child(1) {
padding-top: 20px;
}
#posts article .title {
font-family: "Open Sans", "sans-serif", Arial;
font-size: 36px;
color: rgb(38, 39, 43);
text-align: center;
font-weight: 500;
}
#posts article footer {
display: none;
}
#paginate {
display: none;
}
#bottom {
border: none;
}
#bottom {
border: none;
max-width: 1024px;
width: 100%;
display: block;
margin-left: auto;
margin-right: auto;
}
<header id="top">
<div class="row">
<div class="small-12 small-centered columns">
<img class="headimg" src="http://assets.tumblr.com/images/x.gif?v=1">
<a href="/" class="active">
<div class="title">Page Title</div>
</a>
<div class="description"></div>
<nav>
<a class="page" href="/online-store">Shop NAO</a><a class="page" href="/nao-couture">NAO Couture</a><a class="page" href="/nao-experience">NAO Experience</a>
</nav>
</div>
<!--.columns-->
</div>
<!--.row-->
</header>