Hi there. I am trying to to the “Test your Skills” regarding form elements in CSS. Unfortunately I do not know why padding does not work / only work if I add a background-color element. Can someone explain? Here ist the code:
CSS:
.myform {
border: 2px solid #000;
padding: 5px;
}
input[type="search"], input[type="submit"]
{
font-size:inherit;
padding: 10px;
}
input[type="submit"]
{
background-color: purple; /* if I remove this rule, padding won't apply */
color: white;
border-style: none;
border-radius: 5px;
}
HTML:
<form method="post" action="" class="myform">
<div><label for="fldSearch">Keywords</label>
<input type="search" id="fldSearch" name="keywords">
<input type="submit" name="btnSubmit" value="Search"></div>
</form>