gpt4 book ai didi

html - 标签 和标签 <input> 之间的 CSS 区别

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

我正在使用 CSS 重置,您可以在这里找到:https://meyerweb.com/eric/tools/css/reset/

这是 HTML 代码:

<input class="submitForm" type="submit" value="Confirm" />
<a class="cancelForm" href="{{ path('my_path') }}">Cancel</a>

这是 CSS 代码:

.submitForm {
text-decoration: none;
font-family: "Aero Matics", sans-serif;
color: #FFFFFF;
font-size: 20px;
padding: 20px;
background-color: #65BCF1;
border: 0px none;
font-weight:bold;
float:right;
cursor: pointer;
}

.cancelForm {
text-decoration: none;
font-family: "Aero Matics", sans-serif;
color: #FFFFFF;
font-size: 20px;
padding: 20px;
background-color: #ff9667;
border: 0px none;
font-weight:bold;
float:left;
}

这里是问题:

https://imgur.com/6xC2onI

在图像上,您可以看到“取消”按钮下方有一个空行。

我的问题是:我应该使用哪个 CSS 属性来使我的“基于标签 的按钮”的大小与“确认”按钮的大小完全相同? (我希望按钮从相同的高度开始并填充到页面底部,没有空行)。

最佳答案

当我们没有显式添加 height 属性时,您在这里特别缺少 line-height 属性。请参阅我在重置 css 代码顶部添加的以下代码段:

/* http://meyerweb.com/eric/tools/css/reset/ 
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.submitForm {
text-decoration: none;
font-family: "Aero Matics", sans-serif;
color: #FFFFFF;
font-size: 20px;
padding: 20px;
background-color: #65BCF1;
border: 0px none;
font-weight:bold;
float:right;
cursor: pointer;
}

.cancelForm {
text-decoration: none;
font-family: "Aero Matics", sans-serif;
color: #FFFFFF;
font-size: 20px;
padding: 20px;
background-color: #ff9667;
border: 0px none;
font-weight:bold;
float:left;
}
.submitForm,
.cancelForm {
line-height: 22px;
}
<input class="submitForm" type="submit" value="Confirm" />
<a class="cancelForm" href="{{ path('my_path') }}">Cancel</a>

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