我通过编写外部CSS编写了基于<div></div>
的HTML文档。
但是当我转到新的浏览器时,外观设置会以某种方式改变。
我的背景颜色也没有重新调整大小。当我放大/缩小时,文本的大小会增大/减小。
请帮忙
<html>
<head>
<title>Forms</title>
<link rel="stylesheet" type="text/css" href="style.css"></link>
</head>
<body bgcolor="white">
<form>
<div class="st1">
<font face="Times New Roman" size="5"><b>Personal Details</b></font>
</div>
<div class="st2">
<font face="Times New Roman" size="5"><b>Contact Details</b></font>
</div>
<div class="st4">
<font face="Times New Roman" size="5"><b>Login Details</b></font>
</div>
<div class="st3">
<font face="Times New Roman" size="5"><b>Other Details</b></font>
</div>
<div class="st1a">
<div style="position:absolute;left:22.5%;TOP:2;height:100%">
First name<br>
<input type="text" name="firstname" size="12"><br>
<div style="position:relative;top:4%">
<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="female">Female
</div>
<div style="position:relative;top:7%">
<select name="Day">
<option selected="selected">-DAY-</option>
<script language="javascript">
for(i = 1; i <= 31; i++){
document.write("<option value='"+i+"'>"+i+"</option>");
}
</script>
</select>
<select name="Month">
<option selected="selected">-MONTH-</option>
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select>
<select name="Country">
<option selected="selected">-YEAR-</option>
<script language="javascript">
for(i = 2000; i >= 1950; i--){
document.write("<option value='"+i+"'>"+i+"</option>");
}
</script>
</select>
</div>
<div style="position:relative;top:11%">
<select name="Country">
<option selected="selected">-Select a country-</option>
<option>India</option>
<option>Germany</option>
<option>France</option>
</select>
</div>
<div style="position:relative;top:13%">
<input type="text" name="SS">
</div>
<div style="position:relative;top:13%">
<font size="2">Mandatory for people living in United States Of America</font>
</div>
<div style="position:relative;top:13.5%">
<input type="text" name="SS">
</div>
<div style="position:relative;top:19.5%">
<select name="Area">
<option selected="selected">-Select Area-</option>
<option>India</option>
<option>Germany</option>
<option>France</option>
</select>
<input type="text" name="SS">
</div>
<div style="position:relative;top:26%">
<input type="text" name="SS">
</div>
<div style="position:relative;top:26%">
<font size="2">Please enter the Promo Code.if you have come to this <br>page as a part of promotion.</font>
</div>
</div>
<div style="position:absolute;left:45%;TOP:2;height:100%">
Middle name<br>
<input type="text" name="middlename" size="12">
</div>
<div style="position:absolute;left:67%;TOP:2;height:100%">
Last name<br>
<input type="text" name="Lastname" size="12">
</div>
<div style="position:absolute;left:0%;top:5%">
<font color="red">*</font> Name<br><br>
<font color="red">*</font> Gender<br><br>
<font color="red">*</font> Date Of Birth<br><br>
<font color="red">*</font> Citizenship<br><br>
<font > Social Security#</font><br><br>
<font > Social Insurance#</font><br><br>
<font color="red">*</font> How did you<br> hear about us?<br><br>
Promo Code
</div>
</div>
<div class="st2a">
<div style="position:absolute;left:30%;height:100%">
<div style="position:relative;top:4%">
<input type="text" name="address" size="35"><br>
<input type="text" name="address2" size="35">
</div>
<div style="position:relative;top:6%">
<input type="text" name="city">
</div>
<div style="position:relative;top:9%">
<input type="text" name="state">
</div>
<div style="position:relative;top:13%">
<input type="text" name="zip">
</div>
<div style="position:relative;top:17%">
<select name="country" style="Width:250px">
<option selected="selected" >-Select a country-</option>
<option>India</option>
<option>Germany</option>
<option>France</option>
</select>
</div>
<div style="position:relative;top:22.5%">
<input type="text" name="country" size="6">
<input type="text" name="area" size="6">
<input type="text" name="phone" size="12">
</div>
<div style="position:relative;top:25%">
<input type="text" name="country" size="5">
<input type="text" name="phone">
</div>
<div style="position:absolute;left:0%;top:59%;height:100%">
Country
</div>
<div style="position:absolute;left:30%;top:59%;height:100%">
Area
</div>
<div style="position:absolute;left:60%;top:59%;height:100%">
Phone#
</div>
</div>
<div style="position:absolute;left:0%;top:5%">
<font color="red">*</font> Home Address<br><br><br>
<font color="red">*</font> City<br><br>
<font color="red">*</font> State<br><br>
<font color="red">*</font> Zip/Postal Code<br><br>
<font color="red">*</font> Country Of Residence<br><br>
<font color="red">*</font> Phone<br><br>
Mobile
</div>
</div>
<div class="st3a">
<div style="position:absolute">
<div style="position:relative;left:40%;top:5%">
<input type="text" name="user">
</div>
<div style="position:relative;left:40%;top:5.5%">
<font size="2">The id for login.Minimum 6 characters</font>
</div>
<div style="position:relative;left:40%;top:6%">
<input type="text" name="email">
</div>
<div style="position:relative;left:40%;top:6.5%">
<font size="2">Your e-mail id for communication purposes.</font>
</div>
<div style="position:relative;left:40%;top:8%">
<input type="password" name="pwd">
</div>
<div style="position:relative;left:40%;top:15%">
<input type="password" name="pwd">
</div>
<div style="position:relative;left:40%;top:15.5%">
<font size="2">8 to 16 characters with atleast one numeric digit and no spaces.<br>The password is case sensitive.</font>
</div>
</div>
<div style="position:absolute;left:0%;top:7.5%">
<font color="red">*</font> User Id<br><br>
<font color="red">*</font> E-mail Id<br><br><br>
<font color="red">*</font> Password<br><br>
<font color="red">*</font> Re-type Password
</div>
</div>
<div class="st4a">
<div style="position:absolute">
<div style="position:relative;left:40%;top:5%">
<input type="text" name="Q">
</div>
<div style="position:relative;left:40%;top:5%">
<font size="2">The id for login.Minimum 6 characters<br>Example-What is your mother's birth place?</font>
</div>
<div style="position:relative;left:40%;top:16%">
<input type="text" name="Q">
</div>
<div style="position:relative;left:40%;top:16%">
<small>The Hint answer is case sensitive.Please keep the Hint Question and<br> Answer different from the User id.</small>
</div>
</div>
<div style="position:absolute;left:0%;top:7.5%">
<font color="red">*</font> Hint Question<br><br><br><br>
<font color="red">*</font> Hint Answer
</div>
</div>
<div style="left:45%;bottom:13%;position:absolute">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</div>
</div>
</form>
</body>
</html>
这是我的STYLE SHEET
.st1{
position:absolute;
margin:1;
left:0%;
top:0%;
background-color:Orange;
text-align:left;
width:49.5%;
Height:4%
}
.st1a{
position:absolute;
margin:1;
left:0%;
top:4%;
background-color:#FFE6CD;
text-align:left;
width:49.5%;
height:45%
}
.st2{
position:absolute;
margin:1;
right:0%;
top:0%;
background-color:Orange;
text-align:left;
width:50%;
Height:4%
}
.st2a{
position:absolute;
margin:1;
right:0%;
top:4%;
background-color:#FFE6CD;
text-align:left;
width:50%;
Height:45%
}
.st3{
position:absolute;
margin:1;
right:0%;
top:49.5%;
background-color:Orange;
text-align:left;
height:4%;
width:50%
}
.st3a{
position:absolute;
margin:1;
left:0%;
top:53%;
background-color:#FFE6CD;
text-align:left;
height:31%;
width:49.5%
}
.st4{
position:absolute;
margin:1;
left:0%;
top:49.5%;
background-color:Orange;
text-align:left;
height:4%;
width:49.5%
}
.st4a{
position:absolute;
margin:1;
right:0%;
top:53%;
background-color:#FFE6CD;
text-align:left;
height:31%;
width:50%
}
答案 0 :(得分:3)
position: static
以外的任何内容(默认设置)。正常流程是你的朋友style
属性<label>
等语义标记,而不是<b>
和<font>
<select>
元素的内容)答案 1 :(得分:2)
有两种方法:
1)非常好地学习HTML / CSS,在每个主要浏览器(IE,Firefox,Chrome,Opera,Safari)中进行测试并根据需要进行修复
2)不要编写任何HTML / CSS,写入可以生成HTML作为输出的另一种语言/环境,实质上将浏览器兼容性问题推入中间层,这样您就不必担心了。不确定是否存在这样的100%傻瓜式解决方案;也许GWT?
答案 2 :(得分:2)
看一下像CSS Reset这样的东西,它应该在同一个基础上启动所有浏览器,然后你应用你的样式表。
答案 3 :(得分:1)
这是因为您将固定宽度放在包含颜色的div
中,这就是缩放div
尺寸时保持相同的原因。另外,我认为你不是放大/缩小,而是你只是调整浏览器的大小。请提及浏览器名称,以便每个人都能更好地了解您所看到的内容。另请注意what MK said。