2016-08-02 88 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>