position:absolute 的div 无法cursor:pointer 的问题

问题出现在IE6,7,8,9,10

IE11,firefox,chrome 正常

文档:

http://stackoverflow.com/questions/4378497/ie-bug-absolutely-positioned-element-with-a-non-transparent-background-colour

现象:当设置position:absolute 以后,设置cursor:pointer  无法点击

解决方案:设置一个背景颜色 或者 放一个透明图片可以解决这个问题

div {
      width: 200px; height: 200px;
      position: absolute;
      border: 10px solid black;
      cursor: pointer;
}

*{ padding: 0px; margin: 0px; } #box{ width: 1500px; height: 500px; background-color: black; } #timer { width: 300px; height: 300px; border-radius: 50%; border: 5px dashed #2fa4e4; position: relative; color: aliceblue; } #timer #Tim { position: absolute; left: 60px; top: 30px; text-align: center; font-size: 80px; color: darkgrey; } #timer #m { position: absolute; top: 120px; left: 60px; font-size: 90px; font-weight: bold; } #timer #s { position: absolute; top: 120px; right: 60px; font-size: 90px; font-weight: bold; } #m-s #s1{ position: absolute; top: 110px; left: 110px; font-size: 30px; font-weight: bold; } #m-s #s2{ position: absolute; top: 110px; right: 75px; font-size: 30px; font-weight: bold; } #timer #ms { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 70px; font-weight: bold; } #buttons { display: flex; justify-content: center; margin-top: 20px; } #buttons button { background-color: orange; color: black; font-size: 16px; padding: 10px 20px; margin: 0 10px; border-radius: 5px; border: none; cursor: pointer; } </style> </head> <body> <div id="box"> <div id="timer"> <div id="Tim">Timer</div> <div id="m-s"><span id="s1">m</span><span id="s2">s</span></div> <div id="m">00</div> <div id="s">00</div> <div id="ms">00</div> </div> <div id="buttons"> <button id="start">开始</button> <button id="pause">暂停</button> <button id="reset">复位</button> </div> </div>更改样式使秒表位于画布的水平垂直中心,按钮位于秒表的整下放一次排列
05-26
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值