0

Trying to make contact information, the images are appearing far to the right of the page, when I want it centered, I've tried to put a right margin and padding, but it didn't work, I've removed code, but it didn't do anything. I don't know what else to try.

.contactinfo {
  float: left;
  border: 3px solid #189AB4;
  border-radius: 10px;
  text-align: center;
  margin-top: 20px;
  margin-left: 200px;
  width: 70%;
}

.border {
  float: left;
  background-color: #189AB4;
  margin-left: 125px;
  width: 75%;
  height: 4px;
}

a.contacts {
  background-color: transparent;
  border: none;
  width: 50px;
  height: 50px;
  margin-right: 50px;
  float: left;
}

a.contacts:hover {
  background-color: transparent;
  border: none;
  width: 50px;
  height: 50px;
  margin-right: 50px;
  float: left;
}

a {
  padding-top: 20px;
  text-decoration: none;
  text-align: center;
  background-color: #75E6DA;
  border-right: 2px #189AB4 solid;
  color: #189AB4;
  width: 100px;
  height: 40px;
  float: left;
}
  <div class="content">
    
    <div class="contactNav">
        
        <div class="contact">
            
            <a class="contacts" href="#discord"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/discord.png"></a>
            
            <a class="contacts" href="#email"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/email.png"></a>
            
            <a class="contacts" href="#phone"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/phone.png"></a>
            
        </div>
        
    </div>
    
</div>
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
LitNotFig
  • 1
  • 1

2 Answers2

0

Gave your content class a display: flex and then set your contactNav class a margin: 0 auto

of course this might not be the exact solution since i'm not sure what else is supposed to be within those div blocks that are empty.

.contactinfo {
  float: left;
  border: 3px solid #189AB4;
  border-radius: 10px;
  text-align: center;
  margin-top: 20px;
  margin-left: 200px;
  width: 70%;
}

.border {
  float: left;
  background-color: #189AB4;
  margin-left: 125px;
  width: 75%;
  height: 4px;
}

a.contacts {
  background-color: transparent;
  border: none;
  width: 50px;
  height: 50px;
  margin-right: 50px;
  float: left;
}

a.contacts:hover {
  background-color: transparent;
  border: none;
  width: 50px;
  height: 50px;
  margin-right: 50px;
  float: left;
}

a {
  padding-top: 20px;
  text-decoration: none;
  text-align: center;
  background-color: #75E6DA;
  border-right: 2px #189AB4 solid;
  color: #189AB4;
  width: 100px;
  height: 40px;
  float: left;
}

/* Changes Made Below */

.content {
  display: flex;
}

.contactNav {
  margin: 0 auto;
}
<div class="content">
    
    <div class="contactNav">
        
        <div class="contact">
            
            <a class="contacts" href="#discord"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/discord.png"></a>
            
            <a class="contacts" href="#email"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/email.png"></a>
            
            <a class="contacts" href="#phone"><img src="file:///home/chronos/u-26c9237f54925ea49e23f69beb1df4df160b7039/MyFiles/School/Top5/Images/phone.png"></a>
            
        </div>
        
    </div>
    
</div>
Brandon
  • 374
  • 2
  • 15
0

You can do this;

.contactNav {
   display: flex;
   justify-content: center;
}

That might help

kushyzee
  • 1
  • 3