How to make this button in CSS. I am able to make a circular button button but not able to style second line of text.
Button needs to two lines of text, each styled differently. Also entire area needs to be clickable.
.drs-button{
min-width: 240px;
max-width: 240px;
text-decoration: none;
display: inline-block;
outline: none;
cursor: pointer;
border-style: none;
color: black;
font-size: 4em;
background-color: #ffffff;
border-radius: 100%;
overflow: none;
text-align: center;
padding:0;
}
.drs-button:before {
content:'';
display:inline-block;;
vertical-align:middle;
padding-top:100%;
}
.drs-button:active{
background-color: #2980b9;
}
3
Answers
Have you tried wrapping the text(s) you want styled differently in a span element(s) and then giving them a id/class selector to style it?
Buttons are allowed to contain phrasing content, which includes inline child elements such as
<span>
.So, simply wrap the two parts of your button content in
<span>
elements.Then you can style each span differently, as illustrated in this snippet.
Another way to do it without aspect ratio and last-child pseudo elements.