<div style= "margin-top:5px;margin-left:5px;align:center;text-align:center;display:inline-block"> <a id="firezone_click[i]" href="showurl" target="HMI" style="font-size:18px;">buttonname </a>      </div>;修改此代码,使得点击链接时,链接的颜色发生改变
时间: 2024-02-24 07:57:22 浏览: 26
可以使用CSS样式来实现链接被点击后改变颜色的效果。修改后的代码如下所示:
```
<div style="margin-top:5px;margin-left:5px;align:center;text-align:center;display:inline-block">
<a id="firezone_click[i]" href="showurl" target="HMI" style="font-size:18px; color:black;" onclick="this.style.color='red';">buttonname</a>
</div>
```
在这个代码中,我们给链接元素增加了一个onclick属性,当链接被点击时,会执行其中的JavaScript代码`this.style.color='red';`。这行代码的作用是将链接元素的颜色改为红色。初始时,链接元素的颜色为黑色(由style属性中的color:black指定),点击后颜色会变成红色。这样,点击链接时,链接的颜色就会发生改变了。
相关问题
<div style="display: flex; margin-left: 0;text-align:center;vertical-align:middle;"> <input type ='submit' placeholder ="计算" value="计算" style="display: flex;width:120px;height: 44px;border-style:solid;border-color:#C23531;background-color:#C23531;font-size: 17px;letter-spacing:3px;"> </div>这样设置了,但还是无法居中,而且边框效果也不对
您可以尝试修改CSS样式代码,使其实现居中效果和边框效果,如下所示:
HTML代码:
```html
<div style="display: flex; justify-content: center; align-items: center; margin-left: 0;">
<input type="submit" placeholder="计算" value="计算" style="width: 120px; height: 44px; border: 1px solid #C23531; background-color: #C23531; font-size: 17px; letter-spacing: 3px; color: #fff; text-align: center;">
</div>
```
CSS代码:
```css
div {
display: flex;
justify-content: center;
align-items: center;
margin-left: 0;
}
input[type="submit"] {
width: 120px;
height: 44px;
border: 1px solid #C23531;
background-color: #C23531;
font-size: 17px;
letter-spacing: 3px;
color: #fff;
text-align: center;
}
```
解释:
- `justify-content: center;`和`align-items: center;`可以使得父元素和子元素都在水平和垂直方向上居中。
- `border: 1px solid #C23531;`可以设置边框的颜色和宽度。
- `color: #fff;`可以设置文字的颜色为白色。
这样设置后,应该能够实现您想要的居中和边框效果了。
<el-col :span="6" :xs="24"> <div class="card-list" style="display: flex;width: 100%;flex-wrap: wrap;justify-content: space-between; align-items: center;"> <!--div style="display: flex; justify-content: space-between; align-items: center;"--> <!--el-card style="margin-bottom:20px; width:300px;height:280px"--> <el-card style="width:300px;height:280px; margin-left:1px;margin-bottom: 10px"> <template #header> <div class="h-4 pl-[90px]" style="width: 100%;display: flex;justify-content: space-between; align-items: center;"> <div class="user-block" style="line-height: 30px;font-size: 20px;"> <span class="username text-muted" style="margin-left: 10px;">故障模拟设备</span> <span class="description" style="margin-left: 10px;">教学理论设备</span> </div> <el-tag class="username text-muted" style="margin-left: 10px;color:green">运行</el-tag> <div class="el-icon-setting" style="font-size: 25px; color: rgba(18, 21, 211, 0.829);" @click="update"></div> </div> </template> <div class="flex justify-center" style="display: flex;width: 100%;flex-wrap: wrap;justify-content: space-between; align-items: center;"> <img class="rightullidiv" :src="'../../../static/images/fan.gif'"> <!--img class="w-[100px] h-[100px] rounded-lg" src="'../../../static/images/fan.gif'" alt=""--> <div class="ml-3" style="width:120px;height:280px; margin-left:1px;margin-bottom: 10px"> <!--el-descriptions class="el-descriptions__body" size="small" :column="Number('1')" border--> <el-descriptions size="small" :column="Number('1')" border> <el-descriptions-item label="电压">380 V</el-descriptions-item> <el-descriptions-item label="电流">10 A</el-descriptions-item> <el-descriptions-item label="通讯">正常 </el-descriptions-item> </el-descriptions> </div> </div> </el-card> </div> </el-col>实现图片与el-descriptions-item label="电压"并排放置,如何修改代码
您可以将图片与el-descriptions-item label="电压"都放在一个div中,设置该div的display属性为flex,并设置justify-content为space-between或者space-around。具体代码如下:
```
<div class="flex justify-between">
<img class="rightullidiv" :src="'../../../static/images/fan.gif'">
<el-descriptions size="small" :column="Number('1')" border>
<el-descriptions-item label="电压">380 V</el-descriptions-item>
</el-descriptions>
</div>
```
您可以将以上代码替换掉原来的el-descriptions代码部分即可。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.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)
![](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)
帮我美化此登录页面要求全部使用页内样式:<script src="../js/vue.js"></script> <script src="../plugins/elementui/index.js"></script> <script type="text/javascript" src="../js/jquery.min.js"></script> <script src="../js/axios-0.18.0.js"></script> <style> #control{ margin-left: 600px; background-color: #0abdfe;width: 180px;border-radius:20%} p{ margin-left: 80px;} </style> <body> 登录 账号:<input placeholder="请输入账号" id="username" name="username" required v-model="pass.username">
密码:<input type="password" placeholder="请输入密码" id="password" name="password" required v-model="pass.password"> <button>登录</button> <button>注册</button>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>注册页面</title> <style> /容器/ .container{ max-width: 400px; margin: 0 auto; text-align: center; margin-top: 100px; background-color: #fff; padding: 20px; border-radius: 5px; box-shadow: 0px 0px 5px #ddd; } /表单组/ .form-group{ margin-bottom: 20px; text-align: left; } /表单组标签/ .form-group label{ display: inline-block; width: 70px; font-weight: bold; } /表单组输入框/ .form-group input{ display: inline-block; width: 200px; height: 30px; border-radius: 3px; border: 1px solid #ccc; padding: 5px 10px; } /输入框获取焦点时边框颜色/ .form-group input:focus{ outline: none; border-color: #1E90FF; } /按钮组/ .button-group input{ margin-right: 10px; background-color: #1E90FF; color: #fff; border: none; border-radius: 3px; padding: 5px 20px; font-weight: bold; } /按钮悬停时背景颜色和不透明度/ .button-group input:hover{ cursor: pointer; opacity: 0.8; } /注册组/ .register-group a{ font-size: 12px; text-decoration: none; text-align: right; color: black; } /注册链接悬停时文字下划线/ .register-group a:hover{ text-decoration: underline; } </style> </head> <body> <form action="servletControllRegister" method="post"> <label for="uname">用户名:</label> <input type="text" id="uname" name="uname"/> <label for="upwd">密码:</label> <input type="password" id="upwd" name="upwd"/> <input type="submit" value="注册"/> <input type="reset" value="重置"/> 已有账号?点击登录 </form> </body> </html>是jsp页面
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)