gpt4 book ai didi

html - 如何制作基于
标签的 HTML 页面万无一失?

转载 作者:搜寻专家 更新时间:2023-10-31 22:23:27 25 4
gpt4 key购买 nike

我已经根据<div></div> 编写了一个HTML 文档通过编写外部 CSS。但是当我转到新浏览器时,外观设置不知何故发生了变化。

我的背景颜色也没有调整大小。当我放大/缩小时,只是文本的大小增加/减小了。

请帮忙

<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>&nbsp;Name<br><br>
<font color="red">*</font>&nbsp;Gender<br><br>
<font color="red">*</font>&nbsp;Date Of Birth<br><br>
<font color="red">*</font>&nbsp;&nbsp;Citizenship<br><br>
<font >&nbsp;Social Security#</font><br><br>
<font >&nbsp;Social Insurance#</font><br><br>
<font color="red">*</font>&nbsp;&nbsp;How did you<br>&nbsp;&nbsp;&nbsp;&nbsp;hear about us?<br><br>
&nbsp;&nbsp;&nbsp;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>&nbsp;Home Address<br><br><br>
<font color="red">*</font>&nbsp; City<br><br>
<font color="red">*</font>&nbsp;State<br><br>
<font color="red">*</font>&nbsp; Zip/Postal Code<br><br>
<font color="red">*</font> Country Of Residence<br><br>
<font color="red">*</font> &nbsp;Phone<br><br>
&nbsp;&nbsp;&nbsp;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> &nbsp;User Id<br><br>
<font color="red">*</font> &nbsp;E-mail Id<br><br><br>
<font color="red">*</font> &nbsp;Password<br><br>
<font color="red">*</font> &nbsp;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> &nbsp;Hint Question<br><br><br><br>
<font color="red">*</font> &nbsp;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>

这是我的样式表

    .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%
}

最佳答案

  • 一定要使用 Doctype(触发标准模式)
  • 不要使用 position: static 以外的任何东西(默认)除非非常小心。正常流量是你的 friend
  • validate
  • 不要使用 style属性
  • 请使用具有一定意义的类名和 ID
  • 使用语义标记,例如 <label>而不是表示性标记,例如 <b><font>
  • 请确保内容在没有样式表的情况下也有意义(例如,不要在文档的一部分中使用标签而在文档的完全不同的部分中使用字段,然后尝试使用 CSS 将它们链接在一起)<
  • 不要使用客户端 JavaScript 生成重要内容(例如 <select> 元素的内容)

关于html - 如何制作基于 <div> 标签的 HTML 页面万无一失?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4512239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com