I have a form. Inside of that a fieldset inside of that a legend tag. For some reason the legend tag is not on top of the border (like it should be). Instead its underneath it, like a block element. Image of the problem
I tried adding the fieldset tag position: relative, and the legend tag padding: 0. Didnt work. Also i tried making a completely new form, outside of all bootstrap or my css code, applied the necessary styles (fieldset tag position: relative, and the legend tag padding: 0) and it had the same problem.
Here is my current html + css:
.contact-form {
position: relative;
padding: 10px;
margin: 20px 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.contact-form > legend {
padding: 0;
font-size: 1.2rem;
font-weight: bold;
color: #333;
}
<div class="col-xl-6 col-md-12">
<form id="contactForm" method="POST" action="some_api.php">
<fieldset class="contact-form">
<legend>Ajánlatkérés</legend>
... multiple lines of inputs, labels etc...
</fieldset>
</form>
</div>
I have a form. Inside of that a fieldset inside of that a legend tag. For some reason the legend tag is not on top of the border (like it should be). Instead its underneath it, like a block element. Image of the problem
I tried adding the fieldset tag position: relative, and the legend tag padding: 0. Didnt work. Also i tried making a completely new form, outside of all bootstrap or my css code, applied the necessary styles (fieldset tag position: relative, and the legend tag padding: 0) and it had the same problem.
Here is my current html + css:
.contact-form {
position: relative;
padding: 10px;
margin: 20px 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.contact-form > legend {
padding: 0;
font-size: 1.2rem;
font-weight: bold;
color: #333;
}
<div class="col-xl-6 col-md-12">
<form id="contactForm" method="POST" action="some_api.php">
<fieldset class="contact-form">
<legend>Ajánlatkérés</legend>
... multiple lines of inputs, labels etc...
</fieldset>
</form>
</div>
Share
Improve this question
edited Mar 13 at 11:42
Sean
8,2634 gold badges26 silver badges53 bronze badges
asked Mar 13 at 11:21
PetGamerPetGamer
114 bronze badges
0
1 Answer
Reset to default 0For some reason the tag inherited some css from other sources. I don't know from where, so i just added a few lines of css and the !important property at the end of lines. Yeah css is hard to maintain.
.contact-form > legend {
padding: 0;
font-weight: bold;
color: #333;
float: none !important;
width: auto !important;
margin-bottom: 0 !important;
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744704302a4588961.html
评论列表(0条)