我有一个布局页面,我在每个页面中都使用它。在这些Cshtml页面中,我需要从某些页面中删除滚动条。我提供了一个代码,该代码在谷歌浏览器中正常运行,但是在Internet Explorer中失败。谁能帮我? 预先谢谢。我的代码在下面
document.getElementsByTagName('body')[0].style = 'overflow: hidden';
答案 0 :(得分:1)
Microsoft对浏览器拥有自己的属性。使用此CSS属性:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="1000" height="200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M390.79549408998 139.785864051271L390.79549408998 139.785864051271L436.31875178912 93.2509784032736L453.516426919901 110.448653534055L489.935033079208 67.9602796815307L504.097824363387 79.0881871190941L510.167592056605 66.9486517326586L519.272243596424 73.0184194258763L525.342011289642 60.8788840394409L535.458290778333 65.9370237837866L544.562942318167 49.7509766018775L555.690849755731 54.8091163462232L558.725733602347 45.7044648064038L573.900152835384 54.8091163462232L787.353650046876" fill="none" stroke="#000000" stroke-width="7.0" stroke-dasharray="7, 35" stroke-dashoffset="0" />
<path d="M390.79549408998 139.785864051271L390.79549408998 139.785864051271L436.31875178912 93.2509784032736L453.516426919901 110.448653534055L489.935033079208 67.9602796815307L504.097824363387 79.0881871190941L510.167592056605 66.9486517326586L519.272243596424 73.0184194258763L525.342011289642 60.8788840394409L535.458290778333 65.9370237837866L544.562942318167 49.7509766018775L555.690849755731 54.8091163462232L558.725733602347 45.7044648064038L573.900152835384 54.8091163462232L787.353650046876" fill="none" stroke="#000000" stroke-width="1.0" />
<path d="M390.79549408998 139.785864051271L390.79549408998 139.785864051271L436.31875178912 93.2509784032736L453.516426919901 110.448653534055L489.935033079208 67.9602796815307L504.097824363387 79.0881871190941L510.167592056605 66.9486517326586L519.272243596424 73.0184194258763L525.342011289642 60.8788840394409L535.458290778333 65.9370237837866L544.562942318167 49.7509766018775L555.690849755731 54.8091163462232L558.725733602347 45.7044648064038L573.900152835384 54.8091163462232L787.353650046876" fill="none" stroke="#FFFFFF" stroke-width="5.0" stroke-dasharray="5, 37" stroke-dashoffset="-1" />
<path d="M390.79549408998 139.785864051271L390.79549408998 139.785864051271L436.31875178912 93.2509784032736L453.516426919901 110.448653534055L489.935033079208 67.9602796815307L504.097824363387 79.0881871190941L510.167592056605 66.9486517326586L519.272243596424 73.0184194258763L525.342011289642 60.8788840394409L535.458290778333 65.9370237837866L544.562942318167 49.7509766018775L555.690849755731 54.8091163462232L558.725733602347 45.7044648064038L573.900152835384 54.8091163462232L787.353650046876" fill="none" stroke="#000000" stroke-width="2.0" stroke-dasharray="2, 40" stroke-dashoffset="-2.5" />
</svg>
详细了解here.
答案 1 :(得分:1)
也许是html元素在IE中产生了滚动条。试试这个:
document.getElementsByTagName('body')[0].style = 'overflow: hidden';
document.getElementsByTagName('html')[0].style = 'overflow: hidden';
我通常使用CSS这样处理:
html
{
height: 100%;
margin: 0;
padding: 0;
overflow:hidden;
}
body
{
height: 100%;
margin: 0;
overflow:hidden;
}