2015-08-21 28 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

相关问题