我要一个可以表白的代码
时间: 2024-03-10 09:49:01 浏览: 20
以下是一个简单的可以表白的代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>表白代码</title>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
font-size: 36px;
text-align: center;
color: #e74c3c;
background-color: #f1c40f;
}
.btn {
padding: 10px 20px;
margin-top: 20px;
font-size: 24px;
background-color: #3498db;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
.btn:hover {
background-color: #2980b9;
}
</style>
</head>
<body>
<div class="container">
<p>我喜欢你</p>
<button class="btn">表白</button>
</div>
<script>
const btn = document.querySelector('.btn');
btn.addEventListener('click', () => {
alert('我喜欢你,愿意和你在一起!');
});
</script>
</body>
</html>
```
这段代码会在页面上显示一段文字“我喜欢你”,以及一个“表白”按钮。当用户点击按钮时,会弹出一个提示框,显示“我喜欢你,愿意和你在一起!”。你可以将这段代码发送给你心仪的人,来表达你的心意。
相关推荐
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)