简体   繁体   中英

How to style a button inside an input tag

Hey im trying to change this (working) line of code here:

     *<a href="DPS_Guitarspg3.html">        
        <button style="background-color:rgb(0,0,5)"; type="button"> <p style="color:rgb(111,0,100);">  Guitars</p></button> </a>*

Into an equivalent statement w this kind of format(utilizing a class) here:

*<a href="DPS_Guitarspg3.html">
<input type="button" class="inline" id="redirectButtons">
</a>*

My question is how/where to type in the colored text("Guitars") used in the aforementioned code block in the latter code block. Sorry if this is a bad question, I am awful with HTML. Thanks in advance.

You want a button to function as a hyperlink. To give you full styling control over the button, you could make the button an image file and put the image file inside your hyperlink.

<a href="DPS_Guitarspg3.html">
  <img src="image-of-button.png">
</a>

Alternatively, you could use a front-end library like Bootstrap.

Or, you can style the <a> tag to look/act like a button. Just use the :hover and :active , like this

 .aBtn{ padding:5px 10px; text-decoration:none; color:rgb(111,0,100); background-color:rgb(0,0,5);border:1px solid transparent; } .aBtn:hover {color:white;} .aBtn:active{border:1px solid orange;} 
 <a class="aBtn" href="DPS_Guitarspg3.html">Guitars</a> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM