Home > Back-end >  Change the position of text in HTML
Change the position of text in HTML

Time:06-30

Below is my HTML code that is working fine. Just that I need to change the position of the texts here. Basically, I have written a text like "Top Left" meaning this should be displayed Top left of the button and so on. Can anyone help me here?

<!DOCTYPE html>
<html>

<head>
  <style>
    .new {
      color: black;
    }

    .act_button {
      height: 20vh;
      width: 20vh;
      background-color: #ADD8E6;
      border: none;
      color: white;
      padding: 15px 32px;
      text-align: center;
      text-decoration: none;
      font-size: 16px;
      margin: 4px 2px;
      cursor: pointer;
    }
  </style>
</head>

<body>
  <button  id="show" type="button">
    <div >Top-left Top Right Bottom left Bottom right<div>
  </button>
</body>

</html>

CodePudding user response:

try adding a enter beetween top right

CodePudding user response:

This is what I came up with. The texts are too big to fix in the button's dimensions but this can easily be fixed by changing the font-size or making the button bigger.

<!DOCTYPE html>
<html>
<head>
<style>
.act_button div {
  color: black;
  width: 10vh;
}
.act_button {
  height: 20vh;
  width: 20vh;
  background-color: #ADD8E6;
  border: none;
  color: white;
  display: -webkit-flex;
  -webkit-flex-direction: row;
  -webkit-flex-wrap: wrap;
  padding: 0;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}
</style>
</head>
<body>
<button  id="show" type="button"><div>Top-left</div><div>Top Right</div><div>Bottom left</div><div>Bottom right</div></button>
</body>
</html>

CodePudding user response:

.new {
  color: black;
}
.act_button {
  height: 40vh;
  width: 60vh;
  background-color: #ADD8E6;
  border: none;
  color: white;
  padding: 0px 0px;
  text-decoration: none;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  text-align: left;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button  id="show" type="button"><div >Top-left Top Right Bottom left Bottom right<div></button>
</body>
</html>

  • Related