我喜欢的button风格

我喜欢的button风格

 

其他风格

<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>小猫表白</title> <style> body { font-family: Arial, sans-serif; text-align: center; background-color: #ffebf3; /* 淡粉红色 */ margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; } .cat-image { width: 150px; height: auto; margin-bottom: 20px; } .message { font-size: 24px; color: #333; margin-bottom: 20px; } .buttons { display: flex; gap: 20px; /* 初始间距 */ align-items: center; } .button { padding: 15px 30px; font-size: 18px; color: white; border: none; border-radius: 10px; cursor: pointer; transition: all 0.3s ease; } .yes { background-color: #ff6b81; /* 粉红色 */ } .no { background-color: #70a1ff; /* 蓝色 */ } .hidden { display: none; /* 初始隐藏 */ } .final-image { width: 150px; height: auto; margin-bottom: 20px; } .final-message { font-size: 24px; color: #333; } </style> </head> <body> <!-- 主页面内容 --> <div id="mainContent"> <img src="images/cat.png" alt="小猫" class="cat-image" id="catImage"> <div class="message">可以成为我的恋人吗?</div> <div class="buttons"> <button class="button yes" id="yesButton">可以</button> <button class="button no" id="noButton">不要</button> </div> </div> <!-- “喜欢你”页面内容 --> <div id="yesContent" class="hidden"> <img src="images/cat-yes.png" alt="小猫" class="final-image"> <div class="final-message">喜欢你!!!</div> </div> <!-- “可是我喜欢你啊”页面内容 --> <div id="confessionContent" class="hidden"> <img src="images/love.png" alt="表白图片" class="final-image"> <div class="final-message">可是我喜欢你啊</div> </div> <script> const mainContent = document.getElementById('mainContent'); const yesContent = document.getElementById('yesContent'); const confessionContent = document.getElementById('confessionContent'); const yesButton = document.getElementById('yesButton'); const noButton = document.getElementById('noButton'); const buttonsContainer = document.querySelector('.buttons'); const catImage = document.getElementById('catImage'); let clickCount = 0; // 记录点击次数 const maxClicks = 5; // 最大点击次数 let isImageChanged = false; // 标记图片是否已被替换 // 点击“可以”按钮显示“喜欢你”页面 yesButton.addEventListener('click', () => { mainContent.classList.add('hidden'); // 隐藏主页面 yesContent.classList.remove('hidden'); // 显示“喜欢你”页面 }); noButton.addEventListener('click', () => { if (!isImageChanged) { // 第一次点击时替换小猫图片 catImage.src = 'images/cat2.png'; // 替换为 cat2.png isImageChanged = true; // 标记图片已替换 } if (clickCount < maxClicks) { // 放大“可以”按钮 const currentYesScale = parseFloat(yesButton.style.transform.replace('scale(', '').replace(')', '')) || 1; const newYesScale = currentYesScale + 0.2; // 每次放大0.2倍 yesButton.style.transform = `scale(${newYesScale})`; yesButton.style.transition = 'transform 0.3s ease'; // 缩小“不要”按钮 const currentNoScale = parseFloat(noButton.style.transform.replace('scale(', '').replace(')', '')) || 1; const newNoScale = currentNoScale - 0.1; // 每次缩小0.1倍 noButton.style.transform = `scale(${newNoScale})`; noButton.style.transition = 'transform 0.3s ease'; // 调整按钮间距,避免重叠 const currentGap = parseFloat(getComputedStyle(buttonsContainer).gap); const newGap = currentGap + 10; // 每次增加10px间距 buttonsContainer.style.gap = `${newGap}px`; clickCount++; // 点击次数加1 } else if (clickCount === maxClicks) { // 超过5次后显示“可是我喜欢你啊”页面 mainContent.classList.add('hidden'); // 隐藏主页面 confessionContent.classList.remove('hidden'); // 显示“可是我喜欢你啊”页面 clickCount++; // 避免重复触发 } }); </script> </body> </html>
07-23
let a = ### Uso básico :::demo Use `type`, `plain`,`round` y `circle` para definir estilos a los botones. ```html <el-row> <el-button>Default</el-button> <el-button type="primary">Primary</el-button> <el-button type="success">Success</el-button> <el-button type="info">Info</el-button> <el-button type="warning">Warning</el-button> <el-button type="danger">Danger</el-button> </el-row> <el-row> <el-button plain>Plain</el-button> <el-button type="primary" plain>Primary</el-button> <el-button type="success" plain>Success</el-button> <el-button type="info" plain>Info</el-button> <el-button type="warning" plain>Warning</el-button> <el-button type="danger" plain>Danger</el-button> </el-row> <el-row> <el-button round>Round</el-button> <el-button type="primary" round>Primary</el-button> <el-button type="success" round>Success</el-button> <el-button type="info" round>Info</el-button> <el-button type="warning" round>Warning</el-button> <el-button type="danger" round>Danger</el-button> </el-row> <el-row> <el-button icon="el-icon-search" circle></el-button> <el-button type="primary" icon="el-icon-edit" circle></el-button> <el-button type="success" icon="el-icon-check" circle></el-button> <el-button type="info" icon="el-icon-message" circle></el-button> <el-button type="warning" icon="el-icon-star-off" circle></el-button> <el-button type="danger" icon="el-icon-delete" circle></el-button> </el-row> ``` ::: ### Botón deshabilitado El atributo `disabled` determina su un botón esta deshabilitado. :::demo Use el atributo `disabled` para determinar si un botón esta deshabilitado. Acepta un valor `Boolean`. ```html <el-row> <el-button disabled>Default</el-button> <el-button type="primary" disabled>Primary</el-button> <el-button type="success" disabled>Success</el-button> <el-button type="info" disabled>Info</el-button> <el-button type="warning" disabled>Warning</el-button> <el-button type="danger" disabled>Danger</el-button> </el-row> <el-row> <el-button plain disabled>Plain</el-button> <el-button type="primary" plain disabled>Primary</el-button> <el-button type="success" plain disabled>Success</el-button> <el-button type="info" plain disabled>Info</el-button> <el-button type="warning" plain disabled>Warning</el-button> <el-button type="danger" plain disabled>Danger</el-button> </el-row> ``` ::: ### Botón de texto Botones sin borde ni fondo. :::demo ```html <el-button type="text">Text Button</el-button> <el-button type="text" disabled>Text Button</el-button> ``` ::: ### Botón icono Use iconos para darle mayor significado a Button. Se puede usar simplemente un icono o un icono con texto. :::demo Use el atributo `icon` para agregar un icono. Puede encontrar el listado de iconos en el componente de iconos. Agregar iconos a la derecha del texto se puede conseguir con un tag `<i>`. También se pueden usar iconos personalizados. ```html <el-button type="primary" icon="el-icon-edit"></el-button> <el-button type="primary" icon="el-icon-share"></el-button> <el-button type="primary" icon="el-icon-delete"></el-button> <el-button type="primary" icon="el-icon-search">Search</el-button> <el-button type="primary">Upload<i class="el-icon-upload el-icon-right"></i></el-button> ``` ::: ### Grupo de botones Mostrar un grupo de botones puede ser usado para mostrar un grupo de operaciones similares. :::demo Use el tag `<el-button-group>` para agrupar sus botones. ```html <el-button-group> <el-button type="primary" icon="el-icon-arrow-left">Previous Page</el-button> <el-button type="primary">Next Page<i class="el-icon-arrow-right el-icon-right"></i></el-button> </el-button-group> <el-button-group> <el-button type="primary" icon="el-icon-edit"></el-button> <el-button type="primary" icon="el-icon-share"></el-button> <el-button type="primary" icon="el-icon-delete"></el-button> </el-button-group> ``` ::: ### Botón de descarga Cuando se hace clic en un botón para descargar datos, el botón muestra un estado de descarga. :::demo Ajuste el atributo `loading` a `true` para mostrar el estado de descarga. ```html <el-button type="primary" :loading="true">Loading</el-button> ``` ::: ### Tamaños Además del tamaño por defecto, el componente Button provee tres tamaños adicionales para utilizar en diferentes escenarios. :::demo Use el atributo `size` para setear tamaños adicionales con `medium`, `small` o `mini`. ```html <el-row> <el-button>Default</el-button> <el-button size="medium">Medium</el-button> <el-button size="small">Small</el-button> <el-button size="mini">Mini</el-button> </el-row> <el-row> <el-button round>Default</el-button> <el-button size="medium" round>Medium</el-button> <el-button size="small" round>Small</el-button> <el-button size="mini" round>Mini</el-button> </el-row> ``` ::: ### Atributos | Atributo | Descripción | Tipo | Valores aceptados | Por defecto | | ----------- | --------------------------------------------- | ------- | -------------------------------------------------- | ----------- | | size | tamaño del botón | string | medium / small / mini | — | | type | tipo de botón | string | primary / success / warning / danger / info / text | — | | plain | determinar si es o no un botón plano | boolean | — | false | | round | determinar si es o no un botón redondo | boolean | — | false | | circle | determina si es un botón circular | boolean | — | false | | loading | determinar si es o no un botón de descarga | boolean | — | false | | disabled | deshabilitar el botón | boolean | — | false | | icon | nombre de la clase del icono | string | — | — | | autofocus | misma funcionalidad que la nativa `autofocus` | boolean | — | false | | native-type | misma funcionalidad que la nativa `type` | string | button / submit / reset | button | 用github-markdown-css, highlight.js, vue-markdown这三个工具将这段md格式文档,渲染成html页面中,并且代码标记高亮,表格正常显示,使用vue2语法,给我一个可行的渲染代码
06-20
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值