having a hard time figuring out why these two html elements are overlapping. Below is the HTML and CSS files for the respective elements. I have searched through many threads here but none of the solutions are working. Thanks!
main.css:
#titlesection {
height: auto;
width: 100%;
margin: auto;
padding: 0px;
margin-top: 25px;
margin-bottom: 25px;
position: absolute;
display: block;
}
#contentdiv {
top: 30%;
left: 2%;
width: 97%;
margin: auto;
height: 100%;
position: absolute;
display: block;
}
#title {
padding-top: 50px;
text-align: center;
font-size: 60px;
letter-spacing: 6px;
display: block;
margin-bottom: 1%;
height: auto;
}
#titlesubheading {
margin-top: 10px;
margin-bottom: 10px;
font-size: 30px;
text-align: center;
letter-spacing: 7px;
display: block;
height: auto;
}
#socialmedia {
width: 97%;
display: block;
}
#smtable {
width: 10%;
float: right;
}
#aboutheader {
width: 95%;
margin: auto;
margin-top: 5%;
padding: 10px;
font-size: 30px;
display: block;
position: static;
}
#about {
width: 95%;
margin: auto;
margin-top: 1%;
padding: 0px;
height: auto;
font-size: 20px;
display: block;
}
#abouttext {
width: 60%;
height: auto;
display: block;
margin-left: 10px;
min-height: 140px;
}
index.html :
<body>
<section id="titlesection">
<div id="title">
Abdullah Rehmat
</div>
<div id="titlesubheading">
Freelance Developer
</div>
<div id="socialmedia">
<table id="smtable">
<tbody>
<tr>
<td class="a">
<a href="mailto: rehmat.dev@gmail.com">
<img
src="{{url_for('static', filename='images/email.png')}}"
width="33"
height="33"
/>
</a>
</td>
<td class="a">
<a href="https://twitter.com/ARehmat20" target="_blank">
<img
src="{{url_for('static', filename='images/twitter0.svg')}}"
width="50"
height="50"
/>
</a>
</td>
<td class="a">
<a href="https://github.com/10CodeDev" target="_blank">
<img
src="{{url_for('static', filename='images/github.png')}}"
width="30"
height="30"
/>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div id="contentdiv">
<div id="aboutheader">
About:
</div>
Here is an image of the issue. The aboutheader is overlapping the titlesubheading:
It is because you have both of those elements as position: absolute;
. You can fix it by removing. Update your CSS to be this:
Edit: For your information as well, position lets you reposition elements within certain contexts. position: absolute;
positions an element from the top left of the page, or if its parent has position: relative;
then from that element instead. position: relative;
repositions something from its initial position.
You then use top
, left
, right
, or bottom
, to choose how to reposition the item.
#titlesection {
height: auto;
width: 100%;
margin: auto;
padding: 0px;
margin-top: 25px;
margin-bottom: 25px;
position: relative;
display: block;
}
#contentdiv {
top: 0;
left: 0;
width: 97%;
margin: auto;
height: 100%;
position: relative;
display: block;
}
#title {
padding-top: 50px;
text-align: center;
font-size: 60px;
letter-spacing: 6px;
display: block;
margin-bottom: 1%;
height: auto;
}
#titlesubheading {
margin-top: 10px;
margin-bottom: 10px;
font-size: 30px;
text-align: center;
letter-spacing: 7px;
display: block;
height: auto;
}
#socialmedia {
width: 97%;
display: block;
}
#smtable {
width: 10%;
float: right;
}
#aboutheader {
width: 95%;
margin: auto;
margin-top: 5%;
padding: 10px;
font-size: 30px;
display: block;
position: static;
}
#about {
width: 95%;
margin: auto;
margin-top: 1%;
padding: 0px;
height: auto;
font-size: 20px;
display: block;
}
#abouttext {
width: 60%;
height: auto;
display: block;
margin-left: 10px;
min-height: 140px;
}