CSS对齐不能在不同的设备上工作
问题描述:
我有一个用php(html)和css编写的网站,我的问题是,有时(通常在重定向之后),css对齐中断,除了标题图片之外,一切到左上角。在我的电脑上(即使这样,我已经在谈论上传到主机服务器上的网站),我可以通过刷新页面来解决这个问题,突然之间,一切都应该是这样。在不同的设备上(我曾在2台不同的计算机和3部手机上试过),它从来没有以正确的方式显示出来。我已经在不同的浏览器(Firefox,Chrome,手机浏览器...)上尝试了这一点,但它没有任何区别,所以显然问题是我的编码:D 如果有人感兴趣,我张贴我的CSS代码,如果不,只需跳过它。CSS对齐不能在不同的设备上工作
body{
\t font-family: Arial, sans-serif;
\t font-size: 12pt;
\t height: 100%;
\t width: 100%;
\t margin: 0px;
}
#page{
\t overflow: auto;
\t background: #B6B1B1 url('img/background.JPG') no-repeat center;
\t background-attachment: fixed;
}
img{
\t max-width: 100%;
\t height: auto;
\t width: auto\9;
}
#languages li a{
\t font-weight: bold;
\t color: #191045;
}
#languages li a:hover{
\t color: #E49900;
}
h1 a span{
\t display: none;
}
h1 a{
\t width: 100%;
\t height: 240px;
\t display: block;
\t position: absolute;
\t background: transparent url('img/headerpic.png') no-repeat top center;
}
#menubar{
\t width: 70%;
\t position: absolute;
\t margin: 220 15% 0 15%;
\t text-align: center;
}
#menu li{
\t display: inline-block;
\t height: 40px;
\t line-height: 40px;
\t margin-top: 20;
\t margin-left: 5px;
\t padding: 0 15 0 15;
\t background-color: rgba(25,16,69,0.85);
\t border-radius: 5px; \t
}
#menu .selected{
\t background-color: rgba(255,255,255,0.85);
\t border-style: solid;
\t border-width: 3px;
\t border-color: rgba(25,16,69,0.85);
}
#menu .selected a{
\t color: rgba(25,16,69,0.85);
}
#menu li a{
\t text-decoration: none;
\t color: white;
}
#menu li a:hover{
\t color: #E49900;
}
#main{
\t min-height: 350;
\t position: relative;
\t display:block;
\t background-color: rgba(255,255,255,0.85);
\t width: 70%;
\t margin-left: 15%;
\t margin-right: 15%;
\t margin-top: 340;
\t padding: 15 15 15 15;
\t border-radius: 10px;
\t color: black;
}
footer{
\t position: relative;
\t background-color: rgba(255,255,255,0.85);
\t width: 70%;
\t margin-left: 15%;
\t margin-right: 15%;
\t margin-top: 15;
\t padding: 2.5 15 2.5 15;
\t border-radius: 10px;
\t display: inline-block;
\t bottom: 5px;
\t color: black;
\t font-size: 80%;
\t text-align: center;
}
#footer a{
\t text-decoration: none;
\t color: black;
}
#footer a:hover{
\t color: #E49900;
}
感谢您对所有的提示:)
答
所以,我“哦,这么大的错误”是,我没有写单位后面的数字保证金,填充等...我简单地写了例如10.当我添加px/em ...在它后面,突然一切正常:D
仍然不知道为什么花了我这么长时间才意识到它。 .__
试着让你的问题更加简洁,只包括你需要的东西;没有太多人想要阅读那些文字和代码的墙。 –
修复你的CSS:'width:auto \ 9;'。 auto9? –
@AnonyAstige对不起,如果太长了,我只是想详细解释一下,因为通常有人告诉我,我的解释不是很有帮助......现在我不知道该跳过什么:D –