在html中使用el标签

本文探讨了如何在HTML中使用el标签,并结合Vue.js实例进行详细说明。重点指出el属性需指向包含Vue实例的元素,如`el: '#app'`,确保Vue数据绑定和操作能够正确作用于对应的DOM元素。

需要注意el标签被id 为 app的div所包含,因为
new Vue({
el: ‘#app’, //这个当然也可以换成.app,响应的就得对应class名字
data: function() {
return { visible: false }
}
})

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
	<div class="dv" id="app">
		<br/><br/>
 <el-divider class="pgdi"><span class="spd">XXX</span></el-divider>
                  
   </div>
</body>
  <!-- import Vue before Element -->
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
  <!-- import JavaScript -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: function() {
        return { visible: false }
      }
    })
  </script>
  <style scoped>
  .dv{
  width: 50%;
  margin-top: 10px;
  margin-left:auto;
  margin-right: auto;
  }
  .title{
    width: 100%;
  }
  .table{
    width: 100%;
    margin-top: 5px;
  }
  .tab{
    width: 100%;
  }
  .ip,.se{
    width: 98%;
  }
  .tab td{
    border: 1px solid #E4E7ED;
    text-align-last: center;
  }
  .di{
    width: 39%;
  }
  .pse{
    width: 100%;
  }
  .tdd{
    color: #909399;
    background:#F2F6FC;
  }
  .tg{
    width: 100%;
    border: 1px solid #E4E7ED;
  }
  .tg td{
    border: 1px solid #E4E7ED;
    text-align: center;
    color: gray;
    height: 40px;
  }
  .pgse{
    width: 80%;
  }
  .pgdi{
    width: 100%;
    color: gray;
  }
  .tg2,.tg3{
    width: 100%;
    border: 1px solid #E4E7ED;
  }
  .tg2 td,.tg3 td{
    border: 1px solid #E4E7ED;
    color: gray;
    height: 60px;
    font-size: 0.8em;
    text-align: left;
  }
  .sp{
    color: gray;
    font-size: 0.8em;  
  }
  .spd{
    color: gray;
  }
  .caddiv{
    width: 100%;
    height: 500px;
  }
  </style>
</html>



评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值