Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split text inside button

I have problem with new line... I want Fontawesome icon be on top and text under that. Can someone explaing how to do it?

Here is my code:

.options_button{
	float: left;
	width: 113px;
	height: 57px;
	border-bottom-right-radius: 0px;
	border-bottom-left-radius: 0px;
	border-top-right-radius: 0px;
	border-top-left-radius: 0px;
	padding: 5px;
	border: 2px solid;
	border-color: #5f6a77;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<button class="options_button">
  <i class="fas fa-image"></i>
  Save
</button>
like image 913
Brarord Avatar asked Jul 11 '26 01:07

Brarord


2 Answers

The easiest way is to use flexbox:

.options_button{
	width: 113px;
	height: 57px;
	border-bottom-right-radius: 0px;
	border-bottom-left-radius: 0px;
	border-top-right-radius: 0px;
	border-top-left-radius: 0px;
	padding: 5px;
	border: 2px solid;
	border-color: #5f6a77;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<button class="options_button">
  <i class="fas fa-image"></i>
  Save
</button>
like image 151
Valentin Duboscq Avatar answered Jul 13 '26 16:07

Valentin Duboscq


You can add a br to make a new line

.options_button {
  float: left;
  width: 113px;
  height: 57px;
  border-bottom-right-radius: 0px;
  border-bottom-left-radius: 0px;
  border-top-right-radius: 0px;
  border-top-left-radius: 0px;
  padding: 5px;
  border: 2px solid;
  border-color: #5f6a77;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<button class="options_button">
  <i class="fas fa-image"></i>
  <br/>Save
</button>
like image 28
Thanh Thanh Avatar answered Jul 13 '26 15:07

Thanh Thanh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!