2016-10-25 3 views
2

編集:vakho papidzeの助けを借りて、私はヘッダーを中央に置くことができましたが、まだインラインではなく、正しい位置にあります。 最終版で探しているものの図は、https://gyazo.com/3a71cc861daf2ec897cceed30d4bb576です。過去においてヘッダーがランダムに浮動小数点になります


iが他のページにユーザーを移動ヘッダにのみ3タイトルを、使用していた場合、ヘッダは行に正しい位置にありました。追加のタイトルを追加すると、ヘッダー全体が反転し、ページの右上隅に移動します。ここでは、間違ったヘッダーでページのコードペンを確認できます - https://codepen.io/valik140795/pen/qadXOo

<ul> 
    <style> 
.dropbtn { 
background-color: #282828; 
color: #AA9568; 
padding: 0px; 
font-size: 16px; 
border: none; 
cursor: pointer; 
} 

.dropbtn:hover, .dropbtn:focus { 
background-color: #282828; 
} 


.dropdown { 
position: relative; 
z-index: 999; 
display: inline-block; 
} 

.dropdown-content { 
display: none; 
position: fixed; 
z-index: 999; 
background-color: #282828; 
min-width: 180px; 
overflow: auto; 
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
} 

.dropdown-content a { 
color: #AA9568; 
padding: 3px 5px; 
text-decoration: none; 
display: block; 
} 

.dropdown a:hover {background-color: #282828} 

.show {display:block;} 
</style> 

<div class="dropdown"> 
<button onclick="myFunction()" class="dropbtn"><a href=#fab>ФАБРИКИ</a>  </button> 
    <div id="myDropdown" class="dropdown-content"> 
<a href="#nobilis">Nobilis</a> 
<a href="#colordeseda">Color de Seda</a> 
<a href="#eugenio">Eugenio Colombo</a> 
<a href="#libra">Libra</a> 
    </div> 
</div> 

<script> 
/* When the user clicks on the button, 
toggle between hiding and showing the dropdown content */ 
function myFunction() { 
document.getElementById("myDropdown").classList.toggle("show"); 
} 

function filterFunction() { 
var input, filter, ul, li, a, i; 
input = document.getElementById("myInput"); 
filter = input.value.toUpperCase(); 
div = document.getElementById("myDropdown"); 
a = div.getElementsByTagName("a"); 
for (i = 0; i < a.length; i++) { 
    if (a[i].innerHTML.toUpperCase().indexOf(filter) > -1) { 
     a[i].style.display = ""; 
    } else { 
     a[i].style.display = "none"; 
    } 
} 
} 
</script> 

    <li>|</li> 

    <ul> 
    <style> 
.dropbtn { 
background-color: #282828; 
color: #AA9568; 
padding: 0px; 
font-size: 16px; 
border: none; 
cursor: pointer; 
} 

.dropbtn:hover, .dropbtn:focus { 
background-color: #282828; 
} 


.dropdown { 
position: relative; 
z-index: 999; 
display: inline-block; 
} 

.dropdown-content { 
display: none; 
position: fixed; 
z-index: 999; 
background-color: #282828; 
min-width: 180px; 
overflow: auto; 
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
} 

.dropdown-content a { 
color: #AA9568; 
padding: 3px 5px; 
text-decoration: none; 
display: block; 
} 

.dropdown a:hover {background-color: #282828} 

.show {display:block;} 
</style> 



<div class="dropdown"> 
<button onclick="myFunction()" class="dropbtn"><a href=#fab>ДИЛЕРЫ</a>  </button> 
    <div id="myDropdown" class="dropdown-content"> 
    <a href="#nobilis">Nobilis</a> 
    <a href="#colordeseda">Color de Seda</a> 
    <a href="#eugenio">Eugenio Colombo</a> 
    <a href="#libra">Libra</a> 
    </div> 
</div> 

<script> 
/* When the user clicks on the button, 
toggle between hiding and showing the dropdown content */ 
function myFunction() { 
document.getElementById("myDropdown").classList.toggle("show"); 
} 

function filterFunction() { 
var input, filter, ul, li, a, i; 
input = document.getElementById("myInput"); 
filter = input.value.toUpperCase(); 
div = document.getElementById("myDropdown"); 
a = div.getElementsByTagName("a"); 
for (i = 0; i < a.length; i++) { 
    if (a[i].innerHTML.toUpperCase().indexOf(filter) > -1) { 
     a[i].style.display = ""; 
    } else { 
     a[i].style.display = "none"; 
    } 
} 
} 
</script>   

    <li>|</li> 
    <li><a href="http://www.123contactform.com/form-2178643/My-  Form">Сотрудничество</a></li> 
    <li>|</li> 
    <li><a href="contact.html">Контакты</a></li> 
    </ul> 
</div> 

答えて

0

このような変更と動作します:

.block_header ul { 
 
    position: absolute; 
 
    bottom: 61px; 
 
    right: 0; 
 
    width: 100%; 
 
    text-align: center; 
 
}

+0

は私に次を与える:私場合https://gyazo.com/a19be600b35d574c4d0f8ae10d2a0b4b – Valbone

+0

どのように私は、インラインそれを配置します既に持っている 'コード .block_header ul { 位置:絶対; 下段:61ピクセル; 権利:0; 幅:100%; text-align:center; display:インライン; クリア:なし; white-space:normal; word-wrap:break-word; ' – Valbone

+0

これを追加して正しく動作します。 text-align:center; ' –

関連する問題