制作一个个人作品集展示页
目标: 构建一个功能类似于 https://personalportfolio.freecodecamp.rocks 的应用程序
需求:
你的作品集应该有一个 id 为 welcome-section 的欢迎部分
欢迎部分应该有一个包含文本的 h1 元素
你的作品集应该有一个 id 为 projects 的项目部分
项目部分应该包含至少一个 class 为 project-tile 的元素来保存项目
项目部分应该包含至少一个项目的链接
你的作品集应该有一个 id 为 navbar 的导航栏
导航栏应该至少包含一个链接,你可以点击它来导航到页面的不同部分
你的作品集应该有一个 id 为 profile-link 的链接,在新标签中打开你的 GitHub 或 freeCodeCodeCamp 个人主页
你的作品集应该至少有一个媒体查询
欢迎部分的高度应该等于视口的高度
导航栏应该始终位于视口的顶部
完成需求并通过下面的所有测试来完成这个项目。 赋予它你自己的个人风格。 编程愉快!
注意: 请在你的 HTML 中添加 <link rel="stylesheet" href="styles.css"> 以链接你的样式表并应用你的 CSS
测试
等待中:你的作品集应该有一个 id 为 welcome-section 的欢迎部分。
等待中:你的 #welcome-section 元素应该包含一个 h1 元素。
等待中:在 #welcome-section 元素中,你不应该有任何空的 h1 元素。
等待中:你应该有一个 id 为 projects 的项目部分。
等待中:你的作品集应该包含至少一个 class 为 project-tile 的元素。
等待中:你的 #projects 元素应该包含至少一个 a 元素。
等待中:你的作品集应该有一个 id 为 navbar 的导航栏。
等待中:你的 #navbar 元素应该包含至少一个 a 元素,它的 href 属性以 # 开头。
等待中:你的作品集应该有一个 id 为 profile-link 的 a 元素。
等待中:你的 #profile-link 元素应该有一个值为 _blank 的 target 属性。
等待中:你的作品集应该至少有一个媒体查询。
等待中:你的 #navbar 元素应该始终位于视口的顶部。
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="../css/Personal_Portfolio_Webpage.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Poppins:200i,300,400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway:700&display=swap" rel="stylesheet">
</head>
<body>
<nav id="navbar" class="nav">
<ul class="nav-list">
<li><a href="#welcome-section">About</a></li>
<li><a href="#projects">Work</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<section id="welcome-section" class="welcome-section">
<h1>Hey I am Meter孙</h1>
<p>a web developer</p>
</section>
<section id="projects" class="project-section">
<h2 class="projects-section-header">These are some of my projects</h2>
<div class="projects-grid">
<a href="https://codepen.io/freeCodeCamp/full/zNqgVx" target="_blank" class="project project-tile">
<img class="project-image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/tribute.jpg"
alt="project">
<p class="project-title">
<span class="code"><</span>
Tribute Page
<span class="code">/></span>
</p>
</a>
<a href="https://codepen.io/freeCodeCamp/full/qRZeGZ" target="_blank" class="project project-tile">
<img class="project-image"
src="https://cdn.freecodecamp.org/testable-projects-fcc/images/random-quote-machine.png" alt="project">
<p class="project-title">
<span class="code"><</span>
Random Quote Machine
<span class="code">/></span>
</p>
</a>
<a href="https://codepen.io/freeCodeCamp/full/wgGVVX" target="_blank" class="project project-tile">
<img class="project-image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/calc.png"
alt="project">
<p class="project-title">
<span class="code"><</span>
JavaScript Calculator
<span class="code">/></span>
</p>
</a>
<a href="https://codepen.io/freeCodeCamp/full/mVEJag" target="_blank" class="project project-tile">
<img class="project-image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/map.jpg"
alt="project">
<p class="project-title">
<span class="code"><</span>
Map Data Across the Globe
<span class="code">/></span>
</p>
</a>
<a href="https://codepen.io/freeCodeCamp/full/wGqEga" target="_blank" class="project project-tile">
<img class="project-image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/wiki.png"
alt="project">
<p class="project-title">
<span class="code"><</span>
Wikipedia Viewer
<span class="code">/></span>
</p>
</a>
<a href="https://codepen.io/freeCodeCamp/full/KzXQgy" target="_blank" class="project project-tile">
<img class="project-image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/tic-tac-toe.png"
alt="project">
<p class="project-title">
<span class="code"><</span>
Tic Tac Toe Game
<span class="code">/></span>
</p>
</a>
</div>
<a href="https://codepen.io/FreeCodeCamp/" class="btn btn-show-all" target="_blank">
Show all
<i class="fas fa-chevron-right"></i>
</a>
</section>
<section id="contact" class="contact-section">
<div class="contact-section-header">
<h2>Let's work together...</h2>
<p>How do you take your coffee?</p>
</div>
<div class="contact-links">
<a href="https://facebook.com/freecodecamp" target="_blank" class="btn contact-details"><i
class="fab fa-facebook-square"></i> Facebook</a>
<a id="profile-link" href="https://github.com/freecodecamp" target="_blank" class="btn contact-details"><i
class="fab fa-github"></i> GitHub</a>
<a href="https://twitter.com/freecodecamp" target="_blank" class="btn contact-details"><i
class="fab fa-twitter"></i> Twitter</a>
<a href="mailto:example@example.com" class="btn contact-details"><i class="fas fa-at"></i> Send a mail</a>
<a href="tel:555-555-5555" class="btn contact-details"><i class="fas fa-mobile-alt"></i> Call me</a>
</div>
</section>
<footer>
<p>
**This is just a fake portfolio. All the projects and contact details
given are not real.
</p>
<p>
© Created for
<a href="https://www.freecodecamp.com/" target="_blank">freeCodeCamp <i class="fab fa-free-code-camp"></i></a>
</p>
</footer>
</body>
</html>
CSS
:root {
--main-white: #f0f0f0;
--main-red: #be3144;
--main-blue: #45567d;
--main-gray: #303841;
}
html {
box-sizing: border-box;
font-size: 62.5%;
scroll-behavior: smooth;
}
* {
margin: 0;
padding: 0;
box-sizing: inherit;
}
body {
font-family: 'Poppins', sans-serif;
font-size: 1.8rem;
font-weight: 400;
line-height: 1.4;
color: var(--main-white);
}
.nav {
display: flex;
justify-content: flex-end;
position: fixed;
top: 0;
left: 0;
width: 100%;
background: var(--main-red);
box-shadow: 0 2px 0 rgb(0 0 0 / 40%);
z-index: 10;
}
.nav-list {
display: flex;
margin-right: 2rem;
}
ul {
list-style: none;
}
h1 {
font-size: 6rem;
}
.nav-list a {
display: block;
font-size: 2.2rem;
padding: 2rem;
}
.nav-list a:hover {
background: var(--main-blue);
}
a {
text-decoration: none;
color: var(--main-white);
}
.welcome-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
background-color: #000;
background-image: linear-gradient(62deg, #3a3d40 0%, #181719 100%);
}
.welcome-section > p {
font-size: 3rem;
font-weight: 200;
font-style: italic;
color: var(--main-red);
}
.project-section {
text-align: center;
padding: 10rem 2rem;
background: var(--main-blue);
}
h2 {
font-size: 4.2rem;
}
.projects-section-header {
max-width: 640px;
margin: 0 auto 6rem auto;
}
.projects-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
grid-gap: 4rem;
width: 100%;
max-width: 1280px;
margin: 0 auto 6rem auto;
}
.project {
background: var(--main-gray);
box-shadow: 1px 1px 2px rgb(0 0 0 / 50%);
border-radius: 2px;
}
.project-image {
height: calc(100% - 6.8rem);
width: 100%;
object-fit: cover;
}
img {
display: block;
width: 100%;
}
.project-title {
font-size: 2rem;
padding: 2rem 0.5rem;
}
.code {
color: var(--main-gray);
transition: color 0.3s ease-out;
}
.project:hover .code {
color: #ff7f50;
}
.btn {
display: inline-block;
padding: 1rem 2rem;
border-radius: 2px;
}
.btn-show-all {
font-size: 2rem;
background: var(--main-gray);
transition: background 0.3s ease-out;
}
.btn-show-all:hover {
background: var(--main-red);
}
.btn-show-all > i {
margin-left: 10px;
transform: translateX(0);
transition: transform 0.3s ease-out;
}
.btn-show-all:hover i {
transform: translateX(2px);
}
.contact-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
width: 100%;
height: 80vh;
background: var(--main-gray);
padding: 0.2rem;
}
.contact-section-header > h2 {
font-size: 6rem;
}
.contact-section-header > p {
font-style: italic;
}
.contact-links {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
max-width: 980px;
margin-top: 4rem;
flex-wrap: wrap;
}
.contact-details {
font-size: 2.4rem;
text-shadow: 2px 2px 1px #1f1f1f;
transition: transform 0.3s ease-out;
}
.contact-details:hover {
transform: translateY(8px);
}
footer {
display: flex;
font-weight: 300;
justify-content: space-evenly;
background: var(--main-gray);
padding: 2rem;
border-top: 4px solid var(--main-red);
}
footer > p {
margin: 2rem;
}
footer i {
vertical-align: middle;
}
@media (max-width: 28.75rem) {
footer {
flex-direction: column;
text-align: center;
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。