使按钮适合每个浏览器

时间:2013-01-16 05:40:28

标签: css browser cross-browser zoom

我的网站出现问题。我创建了一个可以打开聊天的按钮。但是此按钮不会在所有浏览器和屏幕监视器中保持正确的位置。由于浏览器缩放,按钮不会保持原样。

这是我的页面:http://www.assembleia.org.br/site/webtv/

CHAT 按钮需要就在框后面,如下图所示:http://imageshack.us/photo/my-images/20/cssfix.jpg/

但在其他浏览器中,按钮会向右和向右移动。 这是我的css:

<style>

* { /* trying to RESET CSS */
  margin: 0;
  padding: 0;
  list-style: none;
  vertical-align: baseline;
}

#tab /* the button CHAT */{
  min-width: 50px;
  min-height: 19px;
  max-width: 50px;
  max-height: 19px;
  position: absolute;
  right: 27%;
/*float: left;*/
  top: 350px;
  display: block;
  cursor: pointer;
  background-image: url('http://www.assembleia.org.br/site/wp-content/uploads/2013/01/buttonchat.png');
  color: white;
}

#panel /* the panel */ {
  min-height: 367px;
  position:absolute;
  left: 1355px;
  top: 171px;
  background-color: #D4D4D4;
  max-height: 367px;
  min-width: 0; /*new line*/
}

#panel .content /* for the chat */ {
  min-width: 100px;
  text-align: center;
  /*margin-right:300px;*/
  margin-right: auto;
  max-width: 100px;
}

#close /* for the little red X after opening the chat */ {
  position: absolute;
  left: 1758px;
  top: 168px;
  background-image: url('http://www.assembleia.org.br/site/wp-content/uploads/2013/01/buttonclose1.png');
  text-decoration: none;
}

#share /* for facebook sharing after opening the chat */ {
  position: absolute;
  left: 1656px;
  top: 540px;
  font-size: 10px;
  font-family: Verdana,sans-serif;
}

</style>

THX ..

2 个答案:

答案 0 :(得分:1)

使用此

#tab {
min-width: 50px;
min-height: 19px;
max-width: 50px;
max-height: 19px;
position: absolute;
right: 50px;
top: 350px;
display: block;
cursor: pointer;
background-image: url('http://www.assembleia.org.br/site/wp-content/uploads/2013/01/buttonchat.png');
color: white;
}

答案 1 :(得分:0)

在父包装div上使用 position:relative; 属性,然后按如下方式更改#tab CSS:

  • 添加职位:绝对;
  • 从上到下更改:50%;
  • 从右向右改变:25px;

这是使用Firebug测试的,应该会产生预期的效果。