shamah
June 24, 2024, 10:41am
1
help me how to set the navbar element to always be at the top of the viewport
<section id="welcome-section">
<h1>Hey i am Mimic</h1>
</section>
<a href="https://freecodecamp.org.javascript calculator.com"></a>
<section class="project-title" id="projects">
<a id="profile-link" target="_blank" href="#https://freecodecamp.org.javascriptcalculator.com"></a>
<title class="project-tile"></title>
</section>
<section id="navbar" >
<a href="#https://freecodecamp.org.javascriptcalculator.com"></a>
</section>
<link rel="stylesheet" href="styles.css"></link>
<div class="navbar">
<a href="#project"></a>
</div>
````@media only screen and(orientation: landscape)
.navbar{
overflow:hidden;
position:fixed;}`
shamah
June 24, 2024, 12:33pm
3
i still not got it after placing this as it is
Please share your CSS code (your original code before implementing that advice please)
Is this live somewhere, like codepen?
shamah
June 24, 2024, 12:58pm
7
<section id="welcome-section">
<h1>Hey i am Mimic</h1>
</section>
<a href="https://freecodecamp.org.javascript calculator.com"></a>
<section class="project-title" id="projects">
<a id="profile-link" target="_blank" href="#https://freecodecamp.org.javascriptcalculator.com"></a>
<title class="project-tile"></title>
</section>
<section id="navbar" >
<a href="#https://freecodecamp.org.javascriptcalculator.com"></a>
</section>
<link rel="stylesheet" href="styles.css"></link>
<div class="navbar">
<a href="#project"></a>
</div>
````@media only screen and(orientation: landscape)
.navbar{
overflow:hidden;
position:fixed;}`
Link element doesn’t need the closing tag.
And the css code should goes within the css file. Also you didn’t have required css code for the challenge project.
And the link to the CSS file
<link rel="stylesheet" href="styles.css">
should go inside the head tag .
shamah
June 25, 2024, 12:14pm
10
i’ve tried the above listed but i still not got it
Please share your updated code.
shamah
June 25, 2024, 12:34pm
12
<head>
<link rel="stylesheet" href="styles.css">
</head>
<section id="welcome-section">
<h1>Hey i am Mimic</h1>
</section>
<a href="https://freecodecamp.org.javascript calculator.com"></a>
<section class="project-title" id="projects">
<a id="profile-link" target="_blank" href="#https://freecodecamp.org.javascriptcalculator.com"></a>
<title class="project-tile"></title>
</section>
<section id="navbar" >
<a href="#https://freecodecamp.org.javascriptcalculator.com"></a>
</section>
<div class="navbar">
<a href="#project"></a>
</div>
@media only screen and(orientation: landscape)
.navbar{
position: fixed;
overflow: hidden;
}
ILM
June 25, 2024, 12:57pm
13
the media query needs {}
graph brackets to surround its content
shamah
June 25, 2024, 2:46pm
14
still not working for the test
Your code is missing a lot of the essential elements. See the following article and compare your code against it. Basic HTML5 Template: Use This HTML Boilerplate as a Starter for Any Web Dev Project .
Does this help?
Keep up the great work.
you need {}
brackets and aslo you need id #
slector. currently you have .class
slector for navbar
acctully, @shamah is only fullfil the user stories for the landing page project of FCC curriculum.
Do you get an error message or hint?
shamah
June 26, 2024, 7:17am
19
<!DOCTYPE html>
<html>
<head><link rel="stylesheet" href="styles.css">
<title>personal portfolio</title>
</head>
<body>
<section id="welcome-section">
<h1>Hey i am Mimic</h1>
</section>
<a href="https://freecodecamp.org.javascript calculator.com"></a>
<section class="project-title" id="projects">
<a id="profile-link" target="_blank" href="#https://freecodecamp.org.javascriptcalculator.com"></a>
<title class="project-tile"></title>
</section>
<section id="navbar" >
<a href="#https://freecodecamp.org.javascriptcalculator.com"></a>
</section>
<div class="navbar">
<a href="#project"></a>
</div>
</body>
</html>
@media only screen and #navbar
{ orientation: landscape;
overflow:hidden;
position:fixed;
}
this is how my updated code looks like any directives further?
ILM
June 26, 2024, 7:58am
20
not valid media, the @media
rule contains selectors , doesn’t have them in the rule
example of @media query:
@media (feature: value) {
selector {
// your css styling for slector goes here
}
}
-I can see that your HTML code contains two titles tags can you remove or change the second one.
-Create a nav tag or a section tag and put the anchor tags (a ) inside it.
<nav id="navbar">
<a href= # ></a>
<a href= # ></a>
<a href= # ></a>
</nav>
-And making the position fixed in the CSS I think you will be good to go.