- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以我正在为我的元素创建一个驱动程序注册表,我需要帮助将这些单选按钮对齐在一行中。我尝试使用 Clear: both;方法以及下面提到的方法:
form label[for="yes"],
form label[for="yes"] + input,
form label[for="no"],
form label[for="no"] + input {
clear: none;
width: auto;
}
但没有任何效果 :( 。我也尝试使用段落标记,但那也不起作用。
这是片段:
body{
margin: 0;
padding: 0;
font-family: sans-serif;
background: #34495e;
}
.box{
width: 300px;
padding: 40px;
position: absolute;
top: 80%;
left: 50%;
transform: translate(-50%,-50%);
background: #191919;
text-align: center;
}
.box h1{
color: white;
text-transform: uppercase;
font-weight: 500;
}
select > option{
background: #191919;
color: white;
}
.box textarea{
height: 75px;
}
.box label[for="Male"],
.box label[for="Male"] + input,
.box label[for="Female"],
.box label[for="Female"] + input,
.box label[for="Other"],
.box label[for="Other"] + input,
.box input[type = "radio"] {
display: inline;
clear: none;
width: auto;
}
.box input[type = "text"],.box input[type = "password"], .box select, .box input[type = "tel"], .box textarea, .box fieldset,
.box input[type = "radio"]{
border:0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #3498db;
padding: 14px 10px;
width: 200px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
}
.box input[type = "text"]:focus,.box input[type = "password"]:focus,.box select:focus, .box input[type = "tel"]:focus,
.box textarea:focus{
width: 280px;
border-color: #2ecc71;
}
.box input[type = "submit"]{
border:0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #2ecc71;
padding: 14px 40px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
cursor: pointer;
}
.box input[type = "submit"]:hover{
background: #2ecc71;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>My Example</title>
<link rel="stylesheet" href="Driver-css.css">
</head>
<body>
<form class="box" method="POST" action="test.html">
<h1>Driver Registration</h1>
<input type="text" name="" placeholder="First Name" required>
<input type="text" name="" placeholder="Middle Name" required>
<input type="text" name="" placeholder="Last Name" required>
<input type="tel" name="phone_number" placeholder="Mobile Number" pattern="[0-9]{10}" required>
<input type="tel" name="phone_number" placeholder="Emergency Number" pattern="[0-9]{10}" required>
<textarea name="comments" placeholder="Address" maxlength="500" required></textarea>
<input type="tel" name="" placeholder="License Number" pattern="[A-Z]{2}[0-9]{13}" required>
<fieldset>
<legend>Gender</legend>
<label for="Male"><input type="radio" name="Gender" required value="Male"> Male</label>
<label for="Female"><input type="radio" name="Gender" required value="Female"> Female</label>
<label for="Other"><input type="radio" name="Gender" required value="Other"> Other </label>
</fieldset>
<select required id="pickup_place" name="pickup_place">
<option value="" selected="selected">Select One</option>
<option value="Automobile" >Automobile</option>
<option value="Civill" >Civil</option>
<option value="Computer" >Computer</option>
<option value="Electrical" >Electrical</option>
<option value="Mechanical" >Mechanical</option>
</select>
<input type="submit" name="" value="Submit">
</form>
</body>
</html>
帮助将不胜感激!
最佳答案
添加以下样式
.box input[type="radio"] {
display: inline;
width: auto;
}
fieldset label {
margin-right: 5px;
}
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: #34495e;
}
.box {
width: 300px;
padding: 40px;
position: absolute;
top: 80%;
left: 50%;
transform: translate(-50%, -50%);
background: #191919;
text-align: center;
}
.box h1 {
color: white;
text-transform: uppercase;
font-weight: 500;
}
select>option {
background: #191919;
color: white;
}
.box textarea {
height: 75px;
}
.box label[for="Male"],
.box label[for="Male"]+input,
.box label[for="Female"],
.box label[for="Female"]+input,
.box label[for="Other"],
.box label[for="Other"]+input,
.box input[type="radio"] {
display: inline;
clear: none;
width: auto;
}
.box input[type="text"],
.box input[type="password"],
.box select,
.box input[type="tel"],
.box textarea,
.box fieldset,
.box input[type="radio"] {
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #3498db;
padding: 14px 10px;
width: 200px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
}
.box input[type="text"]:focus,
.box input[type="password"]:focus,
.box select:focus,
.box input[type="tel"]:focus,
.box textarea:focus {
width: 280px;
border-color: #2ecc71;
}
.box input[type="submit"] {
border: 0;
background: none;
display: block;
margin: 20px auto;
text-align: center;
border: 2px solid #2ecc71;
padding: 14px 40px;
outline: none;
color: white;
border-radius: 24px;
transition: 0.25s;
cursor: pointer;
}
.box input[type="submit"]:hover {
background: #2ecc71;
}
.box input[type="radio"] {
display: inline;
width: auto;
}
fieldset label {
margin-right: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>My Example</title>
<link rel="stylesheet" href="Driver-css.css">
</head>
<body>
<form class="box" method="POST" action="test.html">
<h1>Driver Registration</h1>
<input type="text" name="" placeholder="First Name" required>
<input type="text" name="" placeholder="Middle Name" required>
<input type="text" name="" placeholder="Last Name" required>
<input type="tel" name="phone_number" placeholder="Mobile Number" pattern="[0-9]{10}" required>
<input type="tel" name="phone_number" placeholder="Emergency Number" pattern="[0-9]{10}" required>
<textarea name="comments" placeholder="Address" maxlength="500" required></textarea>
<input type="tel" name="" placeholder="License Number" pattern="[A-Z]{2}[0-9]{13}" required>
<fieldset>
<legend>Gender</legend>
<label for="Male"><input type="radio" name="Gender" required value="Male"> Male</label>
<label for="Female"><input type="radio" name="Gender" required value="Female"> Female</label>
<label for="Other"><input type="radio" name="Gender" required value="Other"> Other </label>
</fieldset>
<select required id="pickup_place" name="pickup_place">
<option value="" selected="selected">Select One</option>
<option value="Automobile">Automobile</option>
<option value="Civill">Civil</option>
<option value="Computer">Computer</option>
<option value="Electrical">Electrical</option>
<option value="Mechanical">Mechanical</option>
</select>
<input type="submit" name="" value="Submit">
</form>
</body>
</html>
关于html - 如何在一行中将单选按钮与标签、图例和字段集对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53984591/
我在 visual studio 中使用它,但编译器声称 h1 不能嵌套在 legend 元素中,但浏览器无论如何都可以呈现它,所以我很困惑这是有效的还是不是? Caption
Matplotlib 中的图例是帮助观察者理解图像数据的重要工具。 图例通常包含在图像中,用于解释不同的颜色、形状、标签和其他元素. 1. 主要参数 当不设置图例的参数时,默认的图例是这样的.
mongoDB分页的两种方法 mongoDB的分页查询是通过limit(),skip(),sort()这三个函数组合进行分页查询的 下面这个是我的测试数据 第一种方法 查询第一页的数据:db.te
我的 grafana 仪表板图例中有这些名称: stats.gauges.all.cloudwatch.communicationapi.dynamodb.ca_communicationapi_re
鉴于以下情况: import pandas as pd import matplotlib.pyplot as plt d=pd.DataFrame({'category':['a','a','a',
我收到此错误,请问出了什么问题? plt.legend(handles=[d1, d2]) File "/usr/lib/python3/dist-packages/matplotlib/pypl
这个问题已经有答案了: python matplotlib: label in histogram (1 个回答) 已关闭 5 年前。 我无法向使用 matplotlib.pyplot 创建的直方图添
我想更改我的图例,我必须删除分页并将所有标题放在一两行中。我想更改图标。 现在是这个样子 我想要这样的东西 我输入了 scrollArrows: 'none' 但它不起作用。这是我在 Controll
我正在创建一个文件来读取一定数量的 .wav 文件,每个文件对应一个音符。我正在对它们中的每一个执行 FFT,并将它们全部绘制在同一个图形上。但是,我在正确打印图例时遇到了问题,它将我想要使用的名称分
我正在 ggplot 中处理多个 sf 几何图形,并希望以点、线和正方形(对于多边形)的形式显示图例。然而,geom_sf图例结合了我的几何特征(即结合线和点)如下所示: library(ggplot
我想要 geom_text()标签根据变量采用字体系列。 根据 ggplot2 docs 上的示例(向下滚动到底部),我已经这样做了(与 ggplot 文档示例中的相同): library(ggplo
我正在绘制一个 geom_tile 图,其中每个点都有一个特定的 p-value。 图的绘制方式很好,p-value 限制在图例上。 我想添加到这个图例的是具有这个 p-value 的数据点的数量。
我有以下 data.frame : my.df = data.frame(mean = c(0.045729661,0.030416531,0.043202944,0.025600973,0.0405
我正在绘图中打印 Case-Shiller 索引: structure(list(Date = structure(c(10957, 11048, 11139, 11231, 11323, 1141
我想绘制一个包含 4 个不同值( 1 )的栅格,并带有描述类别的分类文本图例,例如 2但有彩盒: 我试过使用图例,例如: legend( 1,-20,legend = c("land","ocean/
我在 R 中用 ggplot2 制作了这个图 由以下代码绘制: ggplot(mtcars) + geom_smooth(fill='grey', alpha=0.3, span=0.1, aes
我有来自两个不同数据框的数据。我正在尝试为每个数据框创建图例。我知道我可以组合数据框并进行操作,但是由于我的数据源,从两个不同的数据框进行绘图最有意义。 请在下面找到简化的示例。我已经接近了,但传说中
我将 highchart 的图形保存为 svg。 var chart = $('#graphicName').highcharts(); EXPORT_WIDTH = 1000; render_wid
我想将自定义符号设置为图例项。目前我有矩形。我需要带有勾号的矩形(如彩色复选框)。根据文档,我可以自定义元素,例如符号附近的文本。 但如果我将绘图上的所有元素都设置为自定义图像 ( Example )
我有下面的代码,可以生成饼图和图例。有没有办法让表情符号和饼图具有相同的对应颜色,因为目前表情符号是黑色的。另外,我希望删除图例中的方形色 block ,并且术语“男性”和“女性”出现在正确的表情符号
我是一名优秀的程序员,十分优秀!