2016-08-02 85 views
0

这是我目前的进展情况的图像:对齐两个锚并排

enter image description here

正如你所看到的,锚aligining自己incorrectly.They应该从海誓山盟equidistanct和对称排列。

我做了什么错误,我需要做的是让两个锚元素正确地从左到右对齐,显然有正确的锚点向上推。

我宁愿没有改变定位

a.genericbuttonleft { 
 
    position: static; 
 
    margin: 0px; 
 
    //float:left; 
 

 
} 
 
a.genericbuttonright { 
 
    position: static; 
 
    margin: 52%; 
 
    //float:right; 
 

 
} 
 
.profileinfo { 
 
    position: relative; 
 
    background-color: #202020; 
 
    box-sizing: border-box; 
 
    padding: 20px 20px 25px 20px; 
 
    -webkit-overflow-scrolling: touch; 
 
} 
 
.profileinfo h1 { 
 
    font: 40px/45px'HelveticaNeue-Light', sans-serif-light; 
 
    color: #ffffff; 
 
    margin: 0; 
 
} 
 
.profileinfo a { 
 
    position: absolute; 
 
    right: 30px; 
 
    top: 34px; 
 
    display: block; 
 
    width: 260px; 
 
    box-sizing: border-box; 
 
    padding: 18px 0 16px 0; 
 
    font: 25px/25px'-apple-system', BlinkMacSystemFont, 'HelveticaNeue', Roboto; 
 
    text-decoration: none; 
 
    text-align: center; 
 
    text-transform: uppercase; 
 
    color: #ffffff; 
 
    background-color: #13cc3a; 
 
    border: 0; 
 
    border-radius: 5px; 
 
    margin: 10px auto; 
 
    overflow: hidden; 
 
}
<div class="profileinfo"> 
 
    <h1><!-- this needs to stay here even though not being used --></h1> 
 
    <a class="genericbuttonleft">Search Profiles</a> 
 
    <a class="genericbuttonright">Create a Profile</a> 
 
</div>

+2

删除绝对定位开始... –

+0

@Paulie_D我不能。它对现有结构势在必行 – slicks1

+1

顺便说一句'//''是无效的CSS注释语法 – j08691

回答

1

在这里你去

a.genericbuttonleft { 
 
    margin: 0px; 
 
    left: 0; 
 
} 
 
a.genericbuttonright { 
 
    right: 0; 
 
} 
 
.profileinfo { 
 
    position: relative; 
 
    background-color: #202020; 
 
    box-sizing: border-box; 
 
    padding: 20px 20px 25px 20px; 
 
    -webkit-overflow-scrolling: touch; 
 
} 
 
.profileinfo h1 { 
 
    font: 40px/45px'HelveticaNeue-Light', sans-serif-light; 
 
    color: #ffffff; 
 
    margin: 0; 
 
} 
 
.profileinfo a { 
 
    position: absolute; 
 
    top: 34px; 
 
    display: block; 
 
    width: 260px; 
 
    box-sizing: border-box; 
 
    padding: 18px 0 16px 0; 
 
    font: 25px/25px'-apple-system', BlinkMacSystemFont, 'HelveticaNeue', Roboto; 
 
    text-decoration: none; 
 
    text-align: center; 
 
    text-transform: uppercase; 
 
    color: #ffffff; 
 
    background-color: #13cc3a; 
 
    border: 0; 
 
    border-radius: 5px; 
 
    margin: 10px auto; 
 
    overflow: hidden; 
 
}
<div class="profileinfo"> 
 
    <h1><!-- this needs to stay here even though not being used --></h1> 
 
    <a class="genericbuttonleft">Search Profiles</a> 
 
    <a class="genericbuttonright">Create a Profile</a> 
 
</div>