gpt4 book ai didi

html - 下划线问题与形式

转载 作者:行者123 更新时间:2023-11-28 05:01:35 25 4
gpt4 key购买 nike

我遇到的问题是试图在我的所有输入下显示红色下划线。现在它只做了一半,即使它们都是输入。看来它只是给我的第一部分下划线...有人能看出为什么我的第一部分是唯一带下划线的部分而我的部分不是吗?感谢您的帮助!

这里有一个 jsfiddle 可以看到它: https://jsfiddle.net/acr3jw29/

html:

<body>

<h1>Contact</h1>

<form action="" methods="GET" enctype="multipart/form-data" autocomplete="on" class="contact">
<section class="clearfix">
<fieldset><legend><i class="fa fa-user" aria-hidden="true"></i>

个人信息

<label><span>First Name</span> <input name="first_name" type="text" value="" placeholder="First Name Here" autofocus required/>
</label>
<label><span>Last Name</span><input name="last_name" type="text" value="" placeholder="Last Name Here" autofocus required/>
</label>
<label><span>Date of Birth</span> <input name="date_of_birth" type="date" value="" placeholder="Date of Birth" autofocus required/>
</label>


<label><span>Level of Education</span> <input name="level_of_education" type="" value="" placeholder="" autofocus required/></label>
<select name="education_level">
<option value="High School">High School</option>
<option value="Undergraduate">Undergradute</option>
<option value="Graduate">Graduate</option>
</select>





<label><span>Number of years until next degree is completed </span>
<input type="number" name="quantity" min="1" max="6" autofocus></label>

</fieldset>




<fieldset><legend><i class="fa fa-envelope-o" aria-hidden="true"></i>

联系方式

<label><span>Email</span><input class="ghost-input" name="email" value="" type="email" placeholder="youremail@email.com" autocomplete="off" /></label>

<label><span>Phone Number</span><input name="phonenumber" value="" type="tel" placeholder="743-558-2196" /></label>

<label><span>Website</span><input name="website" value="" type="url" placeholder="https://yoururl.com"/></label>



</fieldset>




</section>




<section class="clearfix column" >


<fieldset><legend><i class="fa fa-laptop" aria-hidden="true"></i>

你的兴趣是什么

<label><span>Web Design</span><input name="webdesign" value="web_design" type="checkbox"/></label>

<label><span>Web Development</span><input name="webdevelopment" value="web_development" type="checkbox" /></label>

<label><span>Computer Science</span><input name="computerscience" value="computer_science" type="checkbox" /></label>




<label><span>Graphic Design</span><input name="graphicdesign" value="graphic_design" type="checkbox" /></label>

<label><span>User Experience</span><input name="userexperience" value="user_experience" type="checkbox" /></label>

<label><span>App Development</span><input name="appdevelopment" value="app_development" type="checkbox" /></label>


</fieldset>



<fieldset><legend><i class="fa fa-volume-control-phone" aria-hidden="true">

</i>

Continuation</legend>



<legend>You can contact me by:</legend>
<br>
<label><span>Contact me by phone</span><input name="contact_me" type="radio" value="phone" checked/></label>
<label><span>Contact me by email</span><input name="contact_me" type="radio" value="email"/></label>
<label><span>Contact me by text</span><input name="contact_me" type="radio" value="text"/></label>
<br>


<legend>I'm interested in:</legend>
<br>

<label><span>Undergraduate</span><input name="interest" type="radio" value="text"/></label>
<label><span>Graduate</span><input name="interest" type="radio" value="text"/></label>
<label><span>Online</span><input name="interest" type="radio" value="text"/></label>

</fieldset>



</section>






</form>
<br>
<input name="submit_to_programmer" type="submit" value="Submit"/>


<script src="https://use.fontawesome.com/8f5d316ef9.js"></script>

</body>

最佳答案

为了在所有浏览器中正确显示,一个快速修复方法是将复选框和单选类型的所有输入容器放在一个范围内。我注意到您已经为代码中的所有 span 元素设置了 display:block;。因此,我为每个 span 容器插入了一个类,该容器将保存输入框和带有内联 block 显示的样式。

看下面的片段

@charset "utf-8";

/* CSS Document */

form.contact label {
display: block;
}

span {
display: block;
border: none;
}

.clearfix:after {
content: " ";
display: block;
clear: both;
}

section {
width: 90%;
}

fieldset {
width: 45%;
float: left;
border: none;
}

input {
border: none;
border-bottom: 2px solid red;
margin: 3px;
}
.in_container{
display:inline-block;
border-bottom:solid red;
}
<body>

<h1>Contact</h1>

<form action="" methods="GET" enctype="multipart/form-data" autocomplete="on" class="contact">
<section class="clearfix">
<fieldset>
<legend><i class="fa fa-user" aria-hidden="true"></i> Personal Information</legend>

<label><span>First Name</span>
<input name="first_name" type="text" value="" placeholder="First Name Here" autofocus required/>
</label>
<label><span>Last Name</span>
<input name="last_name" type="text" value="" placeholder="Last Name Here" autofocus required/>
</label>
<label><span>Date of Birth</span>
<input name="date_of_birth" type="date" value="" placeholder="Date of Birth" autofocus required/>
</label>


<label><span>Level of Education</span>
<input name="level_of_education" type="" value="" placeholder="" autofocus required/>
</label>
<select name="education_level">
<option value="High School">High School</option>
<option value="Undergraduate">Undergradute</option>
<option value="Graduate">Graduate</option>
</select>
<label><span>Number of years until next degree is completed </span>
<input type="number" name="quantity" min="1" max="6" autofocus>
</label>
</fieldset>
<fieldset>
<legend><i class="fa fa-envelope-o" aria-hidden="true"></i> Contact Information</legend>

<label><span>Email</span>
<input class="ghost-input" name="email" value="" type="email" placeholder="youremail@email.com" autocomplete="off" />
</label>

<label><span>Phone Number</span>
<input name="phonenumber" value="" type="tel" placeholder="743-558-2196" />
</label>

<label><span>Website</span>
<input name="website" value="" type="url" placeholder="https://yoururl.com" />
</label>
</fieldset>
</section>
<section class="clearfix column">
<fieldset>
<legend><i class="fa fa-laptop" aria-hidden="true"></i> What are your Interests</legend>
<label><span>Web Design</span>
<span class="in_container">
<input name="webdesign" value="web_design" type="checkbox" />
</span>
</label>

<label><span>Web Development</span>
<span class="in_container">
<input name="webdevelopment" value="web_development" type="checkbox" />
</span>
</label>

<label><span>Computer Science</span>
<span class="in_container">
<input name="computerscience" value="computer_science" type="checkbox" />
</span>
</label>
<label><span>Graphic Design</span>
<span class="in_container">
<input name="graphicdesign" value="graphic_design" type="checkbox" />
</span>
</label>

<label><span>User Experience</span>
<span class="in_container">
<input name="userexperience" value="user_experience" type="checkbox" />
</span>
</label>

<label><span>App Development</span>
<span class="in_container">
<input name="appdevelopment" value="app_development" type="checkbox" />
</span>
</label>

</fieldset>
<fieldset>
<legend><i class="fa fa-volume-control-phone" aria-hidden="true">

</i> Continuation
</legend>
<legend>You can contact me by:</legend>
<br>
<label><span>Contact me by phone</span>
<span class="in_container">
<input name="contact_me" type="radio" value="phone" checked/>
</span>
</label>
<label><span>Contact me by email</span>
<span class="in_container">
<input name="contact_me" type="radio" value="email" />
</span>
</label>
<label><span>Contact me by text</span>
<span class="in_container">
<input name="contact_me" type="radio" value="text" />
</span>
</label>
<br>
<legend>I'm interested in:</legend>
<br>

<label><span>Undergraduate</span>
<span class="in_container">
<input name="interest" type="radio" value="text" />
</span>
</label>
<label><span>Graduate</span>
<span class="in_container">
<input name="interest" type="radio" value="text" />
</span>
</label>
<label><span>Online</span>
<span class="in_container">
<input name="interest" type="radio" value="text" />
</span>
</label>
</fieldset>
</section>
</form>
<br>
<span class="in_container">
<input name="submit_to_programmer" type="submit" value="Submit" />
</span>
<script src="https://use.fontawesome.com/8f5d316ef9.js"></script>
</body>

</html>

关于html - 下划线问题与形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40073856/

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