Hi stackoverflow community. I run into the issue when image elements (social media buttons) are running into the image on my webpage. First of all my elements are overflowing the div box where they are sat. I was trying to fix it with a overflow
property, however it wasn't what I was after. So I tried to use clearfix
to keep elements within the div and that just got out of control. So 2 hours later I still haven't solved the issue. I was trying to use margin-right
to move social buttons away from the image, but it is not working. Also slightly out of this topic, after I have implemented social buttons with relative position my line at the top of the page got shorter in one end. Use to stretch almost across whole page and now it is cut. So, yeah two issues here. I would really appreciate some help. Here is my crucial for two problems code below:
HTML:
<!Doctype html>
<html>
<body>
<link href="style.css" rel="stylesheet">
<div class="top_page">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<ul id="nav_container">
<li><a href="about_proper.html">About</a></li>
<li><a href="articles.html">Articles</a></li>
<li><a href="news.html">News</a></li>
</div>
<div class="media_buttons">
<ul>
<li><a href="about_proper.html"><img src="social/facebook.png" alt="facebook_social_button" style="width:30px;height:30px;"/></a></li>
<li><a href="news.html"><img src="social/twitter.png" alt="twitter_social_button" style="width:30px;height:30px;"/></a></li>
</ul>
</div>
<hr>
<h1>Travel locally and globally</h1>
<div class="content">
<img src="travel.jpg" alt="Go Travel" style="text-align:centre;width:504px;height:228px;"/>
</div>
CSS:
#nav_container {
margin: 0%;
text-align: center;
padding-top: 5px;
left:5px;
right:5px;
width:auto;
}
#nav_container li {
display: inline;
margin: 4%;
font-family: Arial;
}
#nav_container a {
color:#3e3e3e;
background-color:#ffffff;
text-decoration: none;
}
#nav_container a:hover {
background-color:#ffffff;
color: #3e5869;
}
#nav_container a:visited {
color:#357c49;
background-color: #ffffff;
}
div {
padding-top: 50px;
left:5px;
right:5px;
}
h1 {
text-align:center;
margin: auto;
width:60%;
color: #73AD21;
font-family: Arial;
top:-40px;
height: 6%;
padding: 3%;
}
.content {
margin:auto;
text-align:center;
top: 5px;
padding-bottom:45px;
}
.media_buttons {
position:relative;
top:300px;
left:20%;
border:solid;
padding:5px;
display:block;
text-decoration: none;
list-style-type:none;
}
.media_buttons li {
list-style-type:none;
width:100%;
height:100%;
margin-right:50px;
float:left;
}