小编M T*_*M T的帖子

chrome中的不同文本位置.IE和FF

我正在建立一个css和jquery的网站.我的一个脚本是在鼠标单击的特定位置显示文本.文本在谷歌浏览器的预定位置显示良好.但是在IE9和FF17中,它们从预定的位置移开.我的背景图像适合浏览器窗口的大小.

我附上截图,这将提供更好的主意.我也在写代码.也许只需要一个小的调整,但我不明白.请帮帮我.

这是chrome和IE之间的比较. 正确的是铬合金,这是正确的. FF和IE显示在相同的位置. 这是chrome和IE之间的比较.正确的是铬合金,这是正确的.FF和IE显示在相同的位置.

谢谢

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
*Here will my script which is just simple .show and .hide functions*
});
</script>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Train of Thought</title>

<style type="text/css">
html, body {
width: 100%;
height: 100%;
margin-top: 0px;
padding-top: 0px;
top: 0px;
margin-left: 0px;
padding-left: 0px;
left: 0px;
}

body {
overflow: hidden;
}

#background {width: 100%; height: 100%; display: block; position: absolute; z-index:1;}

.content {
visibility:hidden;
border-style: none; …
Run Code Online (Sandbox Code Playgroud)

html css internet-explorer google-chrome

7
推荐指数
1
解决办法
1844
查看次数

为具有相同类的元素分配唯一ID

我正在创建一个网站,其中有两个不同的按钮.

通过使用jQuery,我想隐藏并显示两个元素.这两个元素都是文本.例如,通过点击buttonA,textA应该显示,如果textB可见,它应该隐藏.同样通过点击buttonB,textB应该显示,如果textA可见,它应该隐藏.最初两个文本都应该被隐藏但是加载到它们的位置上.

两个文本在布局上具有相同的定位.我已经定义了一个类(.content是它的名字),它维护了文本的所有样式.现在我面临的问题是我和班级有两个div,但是我无法给文本两个不同的ID.

.content {
  visibility:hidden;
  border-style: none;
  display: block;
  position: fixed;
  text-align: centre;
  z-index: 1;
  margin-top: 40%;
  margin-left: 25%;
  margin-right: 25%;
  background-color: transparent;
  font-size:2.5em;
}
Run Code Online (Sandbox Code Playgroud)

问题在于如何为两个文本分配一些唯一ID

<div class="content">TextA goes here<br></div>
<div class="content">TextB goes here<br></div>
Run Code Online (Sandbox Code Playgroud)

所以当我使用jquery时

$("#ButtonA").click(function(){
  $("#TextA").show();$("#TextB").hide();
});

$("#ButtonB").click(function(){
  $("#TextB").show();$("#TextA").hide();
});
Run Code Online (Sandbox Code Playgroud)

虽然这可能是一个蹩脚的问题,但我无法弄清楚自己,所以不得不问.

jquery

-1
推荐指数
1
解决办法
1096
查看次数

标签 统计

css ×1

google-chrome ×1

html ×1

internet-explorer ×1

jquery ×1