CSS
 Computer >> コンピューター >  >> プログラミング >> CSS

CSSでテキストボタンのスタイルを設定するにはどうすればよいですか?


以下は、CSSでテキストボタンのスタイルを設定するコードです-

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
button {
   border: none;
   color: white;
   font-weight: bolder;
   padding: 20px;
   font-size: 18px;
   cursor: pointer;
   border-radius: 6px;
}
.Success {
   color: #4caf50;
}
.Success:hover {
   background: #e7e7e7;
}
.Info {
   color: #2196f3;
}
.Info:hover {
   background: #e7e7e7;
}
.Warning {
   color: #ff9800;
}
.Warning:hover {
   background: #e7e7e7;
}
.Danger {
   color: #f44336;
}
.Danger:hover {
   background: #e7e7e7;
}
.Default {
   color: black;
}
.Default:hover {
   background: #e7e7e7;
}
</style>
</head>
<body>
<h1>Text Buttons Example</h1>
<button class="Success">Success</button>
<button class="Info">Info</button>
<button class="Warning">Warning</button>
<button class="Danger">Danger</button>
<button class="Default">Default</button>
</body>
</html>

出力

上記のコードは次の出力を生成します-

CSSでテキストボタンのスタイルを設定するにはどうすればよいですか?


  1. CSSで光るテキストを作成するにはどうすればよいですか?

    CSSを使用して光るテキストを作成するためのコードは、次のとおりです- 例 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>    body {       background-color: rgb(0, 0, 0);       font-family

  2. CSSでヘッダーのスタイルを設定するにはどうすればよいですか?

    CSSを使用してヘッダーのスタイルを設定するには、コードは次のとおりです- 例 <!DOCTYPE html> <html> <head> <title>Page Title</title> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    body { &n