A
A
Adex2017-09-08 19:52:30
Joomla
Adex, 2017-09-08 19:52:30

Creating a button with CSS - which styles are best?

From my knowledge - a button can be created (specifically based on the "a" tag) using padding-top, padding-right / width for horizontal dimensions;
height / padding-top, padding-bottom / line-height for vertical ones. Which combination is the most optimized and adaptive?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
N
Notan Royamov, 2019-05-24
@Royamov

This means that the width is limited by the parent element.
Stretch the parent element to full width, give it width: 100%.
In general, in order to avoid unnecessary "haemorrhoids" with layout, it is better to use builders. I recommend SP Page Builder.
You can add lines with limited width and full screen, and insert the necessary elements inside.

A
Alexander Sharomet, 2017-09-08
@Adex

a.btn {
display:inline-block;
padding:10px 15px;
font-size:14px;// можно другой
text-decoration:none;
background-color: на ваше усмотрение
color: тоже самое;
border:1px soled #112233// если нужна обводка

}
a.btn:hover {// по наведению
background-color: на ваше усмотрение
color: тоже самое
}

F
Froggyweb, 2017-09-08
@Froggyweb

button. And you are trying to remake the link, by the way, it has nothing to do with the button at all. You can use span with the same success and divs. The underline does not need to be removed.

V
Victoria Yasinyuk, 2017-09-08
@vita78ru

There are a lot of examples of already designed buttons on the Internet. Here is the first one I liked:
https://html5book.ru/krasivye-knopki-dlya-sayta/ - here is the code
https://html5book.ru/examples/styling-buttons/demo... - here you can poke and test

K
kulaeff, 2017-09-08
@kulaeff

Why use a link as a button? Are you aware of the difference between a button and a link, or did you just formulate the question crookedly? If you need a button (the button causes a certain action), then you need to use the tag and style it. If you want a link that takes you to another page or resource and looks like a button, then yes, you need to use a tag and style it. The expression "a button can be created based on the a tag" is incorrect. <button><a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question