I’m building a portfolio website and want the "About Me" section to appear below the introductory title with a clear separation. My HTML is structured like this:
Please tell me what is wrong since im not able to create a about me section , contact etc like how a portfolio website should be.
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: radial-gradient(ellipse at bottom, #0d1d31 0%, #0c0d13 100%);
overflow: hidden;
}
a {
color: inherit;
text-decoration: inherit;
}
::selection {
background-color: #f7ca18;
color: #1b1b1b;
}
nav {
width: 100%;
background-color: #0b0b0b;
position: fixed;
top: 0;
left: 0;
height: 100px;
overflow: hidden;
font-family: 'Open Sans', sans-serif;
z-index: 100;
}
nav ul {
position: absolute;
top: 0;
left: 0;
list-style-type: none;
padding: 0;
margin: 0;
width: 100vw;
}
nav li {
margin: 0;
float: left;
display: inline-block;
height: 98px;
margin-bottom: 2px;
line-height: 100px;
width: 20vw;
text-align: center;
color: #555;
transition: background-color 0.5s 0.2s ease, color 0.3s ease;
cursor: pointer;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 4px;
font-weight: 800;
transform: translateY(100%);
}
nav li.active {
background-color: #151515;
color: #efefef;
}
nav li.active::after {
content: "";
position: absolute;
bottom: -2px;
left: 0;
width: 100%;
height: 2px;
background-color: #f7ca18;
}
nav li:nth-child(1) {
animation: pop 0.5s 0.15s 1 forwards;
}
nav li:nth-child(2) {
animation: pop 0.5s 0.3s 1 forwards;
}
nav li:nth-child(3) {
animation: pop 0.5s 0.45s 1 forwards;
}
nav li:nth-child(4) {
animation: pop 0.5s 0.6s 1 forwards;
}
nav li:nth-child(5) {
animation: pop 0.5s 0.75s 1 forwards;
}
nav li:nth-child(6) {
animation: pop 0.5s 0.9s 1 forwards;
}
nav li:nth-child(7) {
animation: pop 0.5s 1.05s 1 forwards;
}
nav li:hover {
color: #ececec;
}
nav li:active {
background-color: #222;
}
nav li:nth-child(1):hover ~ .slide {
left: 0;
}
nav li:nth-child(2):hover ~ .slide {
left: 20vw;
}
nav li:nth-child(3):hover ~ .slide {
left: 40vw;
}
nav li:nth-child(4):hover ~ .slide {
left: 60vw;
}
nav li:nth-child(5):hover ~ .slide {
left: 80vw;
}
nav li:nth-child(6):hover ~ .slide {
left: 100vw;
}
nav li:nth-child(7):hover ~ .slide {
left: 120vw;
}
nav li.slide {
position: absolute;
left: -20vw;
top: 0;
background-color: #fff;
z-index: -1;
height: 2px;
margin-top: 98px;
transition: left 0.3s ease;
transform: translateY(0);
}
section {
display: flex;
font-family: 'Open Sans', sans-serif;
flex-direction: column;
align-items: center;
padding: 20px;
}
section .title {
max-width: 80%;
width: 100%;
margin-bottom: 40px;
}
section .title span {
display: inline-block;
font-size: 5vw;
color: #efefef;
width: 100%;
text-transform: uppercase;
transform: translateX(-100%);
animation: byBottom 1s ease both;
font-weight: 600;
letter-spacing: 0.25vw;
}
section .title span:last-child {
font-size: 1rem;
animation: byBottom 1s 0.25s ease both;
}
section .title span a {
position: relative;
display: inline-block;
margin-left: 0.5rem;
text-decoration: none;
color: #f7ca18;
}
section .title span a::after {
content: "";
height: 2px;
background-color: #f7ca18;
position: absolute;
bottom: -10px;
left: 0;
width: 0;
animation: linkAfter 0.5s 1s ease both;
}
<nav>
<ul>
<li><a href="XXX">Home</a></li>
<li>About me</li>
<li>My Projects</li>
<li>Social Media</li>
<li>Contact me</li>
<li class="slide"></li>
</ul>
</nav>
<section>
<div class="title">
<span>Astroisback</span><span>CSE Student at<a target="_black" href="">XXX</a></span>
</div>
</div>
</section>
<section id="about-me">
<h2>About Me</h2>
<p>Welcome to my portfolio website!</p>
</section>
I’m trying to put about me section down side, like how it should be in a portfolio website but as you can see whatever section i create it just does not work that is causing me issue for creating differnt secton for contact me, home , projects, etc.
Yoou can see the image for refernece.
2
Answers
You’re using flex which is causing it to move right side.
You can either use flex-direction: column; or remove flex from section
If you still want to use flex, refer to code below:
As another friend mentioned, if you wanna do this with Flex you should take a look at the document. I changed your code a little bit, hope it helps.