Home > Software design >  Match fieldset width with button width
Match fieldset width with button width

Time:02-13


I have a `fieldset` and a `button` below it and i want these elements width to match.
How could I do that ?
I am new to programming and i don't really know much about CSS, so my field of knowledge is not yet very large.
Thank you.

fieldset {
  position:relative;
  width: 15%;
  margin: 0%;
}
button {
  background-color: black;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}
button:hover {
  background-color: white;
  color: black;
}

CodePudding user response:

You can add width 100% to the button. Is it that what you looking for?

fieldset {
  position:relative;
  width: 15%;
  margin: 0%;
}
button {
  width: 100%;
  background-color: black;
  border: none;
  color: white;
  padding: 15px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}
button:hover {
  background-color: white;
  color: black;  
}
<fieldset>
  <button>btn</button>
</fieldset>

  •  Tags:  
  • css
  • Related