I
I
Ilya Bobkov2015-10-13 13:33:40
css
Ilya Bobkov, 2015-10-13 13:33:40

How to align text to the center?

Hey! There is a button with an icon and text:

<button id = "search_button" title = "приступить к поиску"><img src="img/search.png">найти</button>

The default text is located at the bottom next to the icon. How to position this text in the middle?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene Tatarinov, 2015-10-13
@heksen

I would do like this:

button#search_button {
            background: url('img/search.png') no-repeat center left;
            height: 36px;
            width: 90px;
            text-align: end;
}

For example here .

S
Sergey Goryachev, 2015-10-13
@webirus

button img, button span { display: inline-block; }
<button id = "search_button" title = "приступить к поиску"><img src="img/search.png"><span>найти</span></button>

And the alignment is vertical-align: middle; should be enough. Or play with line height.

S
Stanislav Gorovoy, 2015-10-13
@Cnfc19932

wrap it up to start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question