2015-08-21 26 views
0

瀏覽器中顯示網站html左側的非常寬的空間。我不知道原因,甚至發生了這種情況。 我上傳我的網站住在這裏:http://kfs-saintgeorge.esy.es/爲什麼我的網站左側有一個寬廣的空間?

這是我的CSS文件:

*{ 
    box-sizing: border-box; 

} 

html{ 
    direction: rtl; 
    background-color: #b7b7b7; 
    margin: 0 auto; 
    padding: 0; 
} 

img{ 
    max-width:100%; 
} 

body{ 
    width: 60%; 
    margin: auto; 
    padding: 0; 
} 

div{ 
    border-radius: 10px; 
} 

.centering{ 
    text-align: center; 
} 


#hbackground{ 
    background: url('/images/background.jpg') no-repeat ; 
    background-size: cover; 
    display: block; 
    border-radius: 20px 20px 0px 0px; 
    margin: 10px auto; 
    width: 100%; 
    padding-top:37.01527614571093%; 

} 

.btop{ 
    border-radius: 0; 
    height: 4px; 
    width: 100%; 
} 

#header ul{ 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
    background-color: #1e7989; 
    font-family: hfont; 
    font-size: 20px; 
    display: flex; 
    justify-content: space-around; 
    z-index: 1; 
    margin:10px auto; 
    width: 100%; 
} 

#header li{ 
    width: 9em; 
    height: 70px; 
    background-color: #1e7989; 
    flex: 1 1 auto; 
} 


#header li a{ 
    display: block; 
    line-height: 70px; 

} 

.content { 
    background-color: #ffffff; 
    width:100%; 
    text-align: center; 
    line-height: 2em; 
    line-height: 50px; 
} 

.content p { 
    width: 85%; 
    margin:0 auto; 
    font-family: contentfont; 
    font-weight: bold; 
    font-size: 23px; 
    color:#862222; 
} 

a:link, a:visited{ 
    text-decoration: none; 
    color:#ffffff; 
} 


h2{ 
    color:#187477; 
    font-family: headlinefont; 
    font-weight: normal; 
    text-decoration: underline; 
    text-align: center; 
} 

.mainmenu { 
    cursor: pointer; 
    color:#ffffff; 
    text-align: center; 
    display: block; 
    margin-bottom: 0; 
    bottom: 0; 
    border:0; 
    font-size: 1em; 
    font-weight: bold; 
    width: 100%; 
} 

.submenu { 
    list-style-type: none; 
    padding: 0; 
    text-align: center; 
    background-color: #17243e; 
    margin: 0 auto; 
    display: none; 
    border-radius: 0 0 7px 7px; 
} 

.submenu li { 
    border-bottom: 2px solid white; 
} 

.submenu li:last-child, .submenu li:last-child a:last-child { 
    border-bottom: 0; 
    border-radius: 0 0 7px 7px; 

} 

.submenu a:hover { 
    background-color: aliceblue; 
    color: #000000; 
} 


nav{ 
    width: 29%; 
    display: inline; 
} 

nav div{ 
    margin-bottom: 10px; 
    background-color: #ffffff; 
    padding: 10px; 
    max-width: 100%; 
} 

#sidebar{ 
    background-color: white; 
    padding: 0; 
    font-family: contentfont; 
} 

#sidebar>ul{ 
    list-style-type: none; 
    margin: 0; 
    padding: 20px; 

} 

#sidebar>ul >li{ 
    position: relative; 
    background-color: #1a8891; 
    border:2px solid #0c383a; 
    margin-bottom: 5px; 
    border-radius: 10px; 
} 

#sidebar a:link,#sidebar a:visited{ 
    display: block; 
    position: relative; 
    width: 100%; 
    text-align: center; 
    line-height: 40px; 
    font-size: 1em; 
    font-weight: normal; 
} 

#sidebar li:hover{ 
    background-color: #156b72; 
} 

#body2{ 
    width: 100%; 
    display: flex; 
    justify-content: space-around; 
    align-items:flex-start; 
    flex-direction: row; 
} 

#main_content{ 
    width: 70%; 
    vertical-align: top; 
} 

#footer{ 
    background-color: #05333b; 
    width: 100%; 
    height: 100px; 
    text-align: center; 
    color:#ffffff; 
    font-family: Arial; 
    line-height: 20px; 
    border-radius: 0px; 
    margin: auto; 
    display: block; 
    bottom: 0; 
    right: 0; 

} 

#footer p{ 
    position: relative; 
    top: 50%; 
    transform: translateY(-50%); 
} 

#cp_widget_e6374685-0d11-4dc4-9b95-04f8435cd872{ 
    margin: 0 auto; 
    padding: 10px; 
} 

#homeImages{ 
    background-color: white; 
    margin: auto; 
    text-align: center; 

} 

.mainmenu i{ 
    position: absolute; 
    right: 10%; 
    top:10px; 
    vertical-align: middle; 
} 

@media screen and (max-width: 1200px){ 
    body{ 
     width: 100%; 
    } 

    header ul{ 
     font-size: 5px; 
    } 
} 

#social{ 
    direction: ltr; 
    height: auto; 
    margin: auto; 
    display: flex; 
    justify-content: center; 
    margin-bottom: 10px; 
    flex-wrap: wrap; 
} 

.social{ 
    color:black; 
    padding: 3px; 
} 

.fb:hover{ 
    color:#000098; 
} 

.yt:hover{ 
    color: #ff0000; 
} 

#facebook-page{ 
    max-width: 100%; 
    padding: 0; 
    text-align: center; 
    overflow: hidden; 
} 

.fb-page{ 
    margin: auto; 
    text-align: center; 
    max-width: 100%; 
    padding: 0; 
} 
+0

我無法重現該問題。請添加一小段代碼來重現問題並添加圖片以幫助說明您的錯誤。另外,我注意到快速移動光標在菜單上快速移動會產生一個相當令人討厭的效果,您可能希望解決這個問題。 – jaunt

+0

是的!這是因爲jQuery .mouseenter()和.mouseleave()事件處理程序。是否有解決該問題的方法? –

+0

嗯我不確定,但不要嘗試使用事件監聽器;從屬性「onfocus」和「onblur」調用該函數。我確信這會在SO之前撐起來,所以只要看看我是否錯了;) – jaunt

回答

1

至於我可以看到它是因爲在你的HTML元素 direction: rtl標籤。

試圖把它裏面#body2

#body2 { 
    width: 100%; 
    display: flex; 
    justify-content: space-around; 
    align-items: flex-start; 
    flex-direction: row; 
    direction: rtl; 
} 
+0

謝謝,這解決了這個問題。 但爲什麼方向:rtl在html導致發生? –

+0

它向整個網站應用了「從右到左」的方向 - 所有元素,而不僅僅是文本。如果你看'#body2',應用'direction:rtl'也會改變div的佈局,所以它不僅適用於文本。 – 5208760

相關問題