简体   繁体   English

如何在输入标签内设置按钮样式

[英]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. 我的问题是在后面的代码块中如何/在何处键入上述代码块中使用的彩色文本(“ Guitars”)。 Sorry if this is a bad question, I am awful with HTML. 抱歉,如果这是一个不好的问题,我对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. 另外,您可以使用Bootstrap之类的前端库。

Or, you can style the <a> tag to look/act like a button. 或者,您可以设置<a>标记的样式,使其看起来/像按钮一样。 Just use the :hover and :active , like this 只需使用:hover:active ,就像这样

 .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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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