帮我写一个html的按钮,要求按钮可以发光,按钮大小占满半个屏幕,垂直居中,上下居中
时间: 2023-04-09 19:04:24 浏览: 98
以下是一个简单的 HTML 按钮代码,可以满足您的要求:
```html
<button style="background-color: #f9a825; color: #fff; padding: 20px; font-size: 24px; border: none; border-radius: 10px; box-shadow: 0px 0px 20px #f9a825;">点击我</button>
```
这个按钮的样式包括:
- 背景颜色为 #f9a825
- 文字颜色为 #fff
- 内边距为 20px
- 字体大小为 24px
- 边框为无
- 圆角为 10px
- 阴影为 0px 0px 20px #f9a825
您可以将这个代码放在您的 HTML 文件中,然后在需要的地方使用该按钮。
相关问题
帮我写一个html返回按钮要求在页面中居中带有一定的圆角效果
当然可以,您需要在您的HTML代码中添加以下类:
.btn-back {
display: block;
margin: 0 auto; /*使其居中*/
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
background-color: #f2f2f2;
border-radius: 20px; /*添加圆角*/
}
然后在网页中添加一个返回按钮:
<a href="javascript:history.back();" class="btn-back">返回</a>
这样就可以在页面中居中带有圆角效果的返回按钮了。
帮我用HTML+CSS写出一个发光的按钮
好的,可以使用以下代码来制作一个发光的按钮:
HTML代码:
```html
<button class="glow-button">发光的按钮</button>
```
CSS代码:
```css
.glow-button {
background-color: #4CAF50; /* 背景色 */
border: none; /* 去掉按钮边框 */
color: white; /* 文字颜色 */
padding: 15px 30px; /* 按钮内边距 */
text-align: center; /* 文字居中 */
text-decoration: none; /* 去掉下划线 */
display: inline-block;
font-size: 16px; /* 文字大小 */
margin: 4px 2px; /* 按钮边距 */
cursor: pointer; /* 鼠标样式 */
position: relative; /* 让伪元素定位 */
}
.glow-button::before,
.glow-button::after {
content: "";
background: #4CAF50;
position: absolute;
width: 0%;
height: 100%;
top: 0;
left: 0;
opacity: 0.5;
transition: all 0.5s;
z-index: -1;
}
.glow-button:hover::before,
.glow-button:hover::after {
width: 100%;
opacity: 1;
}
.glow-button:hover {
color: #333;
font-weight: bold;
}
```
这样就可以得到一个发光的绿色按钮了。如果需要自定义颜色,可以修改背景色和伪元素的背景色。