0

I have a div/button element, can I make it a Squire shape using their parent width how to achieve this.

    button {
       width: 150px;
       background: red;
       color: white;
       outline: 0;
    }
<button>Button</button>

Here the screenshot for result: enter image description here

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Md. Abu Sayed
  • 2,396
  • 2
  • 18
  • 26

1 Answers1

1

you need to set width & height for parent and set button width & height to 100%

.parent {
  width: 150px;
  height: 150px;
}

button {
  width: 100%;
  height: 100%;
  background: red;
  color: white;
  outline: 0;
}
<div class="parent">
  <button>Button</button>
</div>

or set height: 150px for button so it will be squire!

kian
  • 1,449
  • 2
  • 13
  • 21