html中如何使整个页面变窄

发布网友 发布时间:2022-04-27 03:01

我来回答

5个回答

热心网友 时间:2022-04-24 14:24

第一个问题:

 我不是看得很明白,不过假如是要改变页面的宽可以通过更改body的css样式来实现

例如:

 <style>
    body{
      margin:0px;
      width:80%;
     /*页面的宽度*/
      height:100%;
     /*页面的高度*/
   }
</style>

第二个问题:

  这个要用js脚本实现

 例如:

<!--html代码-->
<table>
 <tr  onMouseover = 'mouseOver(this)'    onMouseout = 'mouseOut(this)' >
   <td>行1</td>
 </tr>
 <tr  onMouseover = 'mouseOver(this)'    onMouseout = 'mouseOut(this)'>
   <td>行2</td>
 </tr>
 <tr  onMouseover = 'mouseOver(this)'    onMouseout = 'mouseOut(this)'>
   <td>行3</td>
 </tr>
</table>
<style>
   .red{
     background-color:#ff0000;
   }
</style>
<!--script 代码-->
<script>
     var mouseOver = function(ele){
          ele.className = 'red';
    }
   var mouseOut = function(ele){
       ele.className = '';
   }
</script>

在行上绑定事件就可以了,我建议用jquery工具类写比较方便,直接tr.hover()全搞定了。

当然也可以用css的伪类:hover这里就不写了,希望有用。

热心网友 时间:2022-04-24 15:42

可以设置一下 body的宽度

热心网友 时间:2022-04-24 17:17

body {margin:auto;padding:0px;width:80%} //屏幕的宽度为百分之百,你想要多大可以自己调,边距调为自动,让它居中显示,改变表格背景颜色可以用javascript也可以用css的hover来做

热心网友 时间:2022-04-24 19:08

一步到位是不可能的,只能自己一点一点改的。

热心网友 时间:2022-04-24 21:16

请问一下, 16:9的浏览器 是神马意思?

横向占满了可能是你版心太宽了吧。一般不要大于1003;

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com