Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS로 블록 버튼(전체 너비)의 스타일을 지정하는 방법은 무엇입니까?


다음은 CSS로 블록 버튼을 만드는 코드입니다 −

예시

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.blockBtn {
   display: block;
   width: 100%;
   border: none;
   background-color: rgb(19, 0, 105);
   color: white;
   padding: 14px 28px;
   font-size: 36px;
   cursor: pointer;
   text-align: center;
   font-weight: bold;
}
.blockBtn:hover {
   background-color: rgb(132, 161, 255);
   color: black;
}
</style>
</head>
<body>
<h1 style="text-align: center;"<Block Button Example</h1>
<button class="blockBtn"<Block Button</button>
</body>
</html>

출력

위의 코드는 다음 출력을 생성합니다 -

CSS로 블록 버튼(전체 너비)의 스타일을 지정하는 방법은 무엇입니까?