curriculum/challenges/english/blocks/build-a-personal-portfolio-webpage-project/bd7158d8c242eddfaeb5bd13.md
Objective: Build an app that is functionally similar to <a href="https://personal-portfolio.freecodecamp.rocks" target="_blank" rel="noopener noreferrer nofollow">https://personal-portfolio.freecodecamp.rocks</a>. Do not copy this demo project.
User Stories:
id of welcome-sectionh1 element that contains textid of projectsclass of project-tile to hold a projectnavbarprofile-link, which opens your GitHub or freeCodeCamp profile in a new tabFulfill the user stories and pass all the tests below to complete this project. Give it your own personal style. Happy Coding!
Note: Be sure to add <link rel="stylesheet" href="styles.css"> in your HTML to link your stylesheet and apply your CSS
Your portfolio should have a "Welcome" section with an id of welcome-section.
const el = document.getElementById('welcome-section');
assert.isNotNull(el);
Your #welcome-section element should contain an h1 element.
assert.isAbove(
document.querySelectorAll('#welcome-section h1').length,
0,
'Welcome section should contain an h1 element '
);
You should not have any empty h1 elements within #welcome-section element.
assert.isAbove(
document.querySelectorAll('#welcome-section h1')?.[0]?.innerText?.length,
0,
'h1 element in welcome section should contain your name or camper ' + 'name '
);
You should have a "Projects" section with an id of projects.
const el = document.getElementById('projects');
assert.isNotNull(el);
Your portfolio should contain at least one element with a class of project-tile.
assert.isAbove(document.querySelectorAll('#projects .project-tile').length, 0);
Your #projects element should contain at least one a element.
assert.isAbove(document.querySelectorAll('#projects a').length, 0);
Your portfolio should have a navbar with an id of navbar.
const el = document.getElementById('navbar');
assert.isNotNull(el);
Your #navbar element should contain at least one a element whose href attribute starts with #.
const links = [...document.querySelectorAll('#navbar a')].filter(
nav => (nav?.getAttribute('href') || '').substring(0, 1) === '#'
);
assert.isAbove(links.length, 0, 'Navbar should contain an anchor link ');
Your portfolio should have an a element with an id of profile-link.
const el = document.getElementById('profile-link');
assert.isNotNull(el);
assert.strictEqual(el.tagName, 'A');
Your #profile-link element should have a target attribute of _blank.
const el = document.getElementById('profile-link');
assert.isNotNull(el);
assert.strictEqual(el.target, '_blank');
Your portfolio should use at least one media query.
const htmlSourceAttr = Array.from(document.querySelectorAll('source')).map(el => el.getAttribute('media'))
const cssCheck = new __helpers.CSSHelp(document).getCSSRules('media')
assert.isTrue(cssCheck.length > 0 || htmlSourceAttr.length > 0);
Your #navbar element should always be at the top of the viewport.
const timeout = milliseconds =>
new Promise(resolve => setTimeout(resolve, milliseconds));
const navbar = document.getElementById('navbar');
assert.approximately(
navbar?.getBoundingClientRect().top,
0,
15,
"Navbar's parent should be body and it should be at the top of " +
'the viewport '
);
window.scroll(0, 500);
await timeout(1);
assert.approximately(
navbar?.getBoundingClientRect().top,
0,
15,
'Navbar should be at the top of the viewport even after ' + 'scrolling '
);
window.scroll(0, 0);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<title>Personal Portfolio</title>
</head>
<body>
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
<!--Font Reference-->
<nav id="navbar">
<a href="#projects">Projects</a> |
<a href="#contact">Contact me</a>
</nav>
<main>
<section id="welcome-section">
<h1>It's me!</h1>
<h2>Naomi Carrigan</h2>
<p>Welcome to my portfolio page!</p>
</section><hr>
<section id="projects">
<h1>Projects</h1>
<h2><a href="https://codepen.io/nhcarrigan">Here's what I've worked on!</a></h2>
<p class="project-tile">
<iframe height="265" style="width: 25;" scrolling="no" title="Algebraic Concepts" src="https://codepen.io/nhcarrigan/embed/preview/NWGrWBR?height=265&theme-id=dark&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true" loading="lazy">
See the Pen <a href='https://codepen.io/nhcarrigan/pen/NWGrWBR'>Algebraic Concepts</a> by Naomi Carrigan
(<a href='https://codepen.io/nhcarrigan'>@nhcarrigan</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<iframe height="265" style="width: 25;" scrolling="no" title="Pokemon Daycare Service" src="https://codepen.io/nhcarrigan/embed/preview/mdeEbeq?height=265&theme-id=dark&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true" loading="lazy">
See the Pen <a href='https://codepen.io/nhcarrigan/pen/mdeEbeq'>Pokemon Daycare Service</a> by Naomi Carrigan
(<a href='https://codepen.io/nhcarrigan'>@nhcarrigan</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<iframe height="265" style="width: 25;" scrolling="no" title="Togepi Fan Club" src="https://codepen.io/nhcarrigan/embed/preview/vYNGoBE?height=265&theme-id=dark&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true" loading="lazy">
See the Pen <a href='https://codepen.io/nhcarrigan/pen/vYNGoBE'>Togepi Fan Club</a> by Naomi Carrigan
(<a href='https://codepen.io/nhcarrigan'>@nhcarrigan</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
<iframe height="265" style="width: 25;" scrolling="no" title="Togepi" src="https://codepen.io/nhcarrigan/embed/preview/yLYOWEN?height=265&theme-id=dark&default-tab=result" frameborder="no" allowtransparency="true" allowfullscreen="true" loading="lazy">
See the Pen <a href='https://codepen.io/nhcarrigan/pen/yLYOWEN'>Togepi</a> by Naomi Carrigan
(<a href='https://codepen.io/nhcarrigan'>@nhcarrigan</a>) on <a href='https://codepen.io'>CodePen</a>.
</iframe>
</p></section><hr>
<section id="contact">
<h1>Contact me!</h1>
<h2>Use the links below to get in touch.</h2>
<p><a href="https://www.freecodecamp.org/nhcarrigan" id="profile-link" target="_blank" rel="noopener noreferrer">FreeCodeCamp.org</a> | <a href="https://github.com/nhcarrigan" id="github-link" target="_blank" rel="noopener noreferrer">GitHub</a> | <a href="https://www.facebook.com/nhcarrigan" id="facebook-link" target="_blank" rel="noopener noreferrer">Facebook</a> | <a href="https://www.linkedin.com/in/Naomi-l-carrigan/" id="linkedin-link" target="_blank" rel="noopener noreferrer">LinkedIn</a>
</section>
<footer><a href="../">Return to Project List</a> | <a href="https://www.nhcarrigan.com">Return to HomePage</a></footer>
</body>
</html>
nav {
position: fixed;
width: 100%;
text-align: right;
font-size: 24pt;
top: 0%;
right: 5px;
background-color: #000000;
color: #ffffff;
}
@media (max-width: 500px) {
nav {
display: none;
}
}
a {
color: #ffffff;
}
main {
text-align: center;
background-color: black;
font-family: Pacifico;
}
h1 {
font-size: 48pt;
}
h2 {
font-size: 24pt;
}
p {
font-size: 12pt;
}
#welcome-section {
background-color: #251a4a;
color: #ffffff;
display: table-cell;
vertical-align: middle;
width: 100vw;
height: 100vh;
}
#projects {
background-color: #060a9c;
color: #ffffff;
display: table-cell;
vertical-align: middle;
width: 100vw;
height: 100vh;
}
#contact {
background-color: #03300b;
color: #ffffff;
display: table-cell;
vertical-align: middle;
width: 100vw;
height: 100vh;
}
<head><style>@media (max-width: 500px){nav{display: none;}}</style></head><body><nav id="navbar"><a href="#projects">text</a> | </nav><main><section id="welcome-section"><h1>text</h1></section><hr><section id="projects"><h1>Projects</h1><h2 class="project-tile"><a id="profile-link" target="_blank" href="https://freecodecamp.org">text</a></h2></section><hr></body></html>