2016-10-23 38 views
0

我的代碼打轉轉,測試的東西..一切工作不錯,但我刷新頁面之後,一切都開始工作「怪異」位置:相對開始工作,比第一(asp.net)不同

這是在admin.aspx的代碼:

<div id="LeftCenterPanel"> 
    <a href="#" id="Dashb" class="TableButtons">Dashboard</a> 
    <a href="#" id="Doct" class="TableButtons">Doctors</a> 
</div> 

併爲那些CSS代碼:

#LeftCenterPanel { 
    position: absolute; 
    top: 120px; 
    left: 0; 
    width: 260px; 
} 

.TableButtons { 
    position: relative; 
    top: 0; 
    left:0; 

    width: 100%; 

    border-bottom: 1px solid #373e4a; 
    text-decoration: none;  
} 
    .TableButtons:hover{ 
     background-color: #373e4a; 
     transition: all 0.5s ease 0s; 
    } 

在第一。儀表板和醫生按鈕相互之間,最大寬度。 現在他們彼此相鄰,與文本的最大寬度..即使我改變寬度200像素仍然保持不變

回答

0

您可以嘗試浮動:左的標籤

#LeftCenterPanel { 
 
    position: absolute; 
 
    top: 120px; 
 
    left: 0; 
 
    width: 260px; 
 
} 
 

 
.TableButtons { 
 
    position: relative; 
 
    top: 0; 
 
    left:0; 
 
    float:left; 
 
    width: 100%; 
 

 
    border-bottom: 1px solid #373e4a; 
 
    text-decoration: none;  
 
} 
 
    .TableButtons:hover{ 
 
     background-color: #373e4a; 
 
     transition: all 0.5s ease 0s; 
 
    }
<div id="LeftCenterPanel"> 
 
    <a href="#" id="Dashb" class="TableButtons">Dashboard</a> 
 
    <a href="#" id="Doct" class="TableButtons">Doctors</a> 
 
</div>