VS-Code使用小问题

本文介绍了在VSCode中编写HTML的基本技巧,包括使用快捷键生成HTML框架,安装并使用ViewInBrowser插件预览网页,以及如何通过保存文件使更改生效。文中还提供了HTML、CSS和JavaScript结合使用的示例代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vscode
初次在VScode中写 HTML,遇到的一些小问题。

  1. !+TAB可以快速生成HTML框架代碼。
  2. 预览网页首先需要安装插件,找到安装插件的库,安装插件 View In Browser插件。
  3. vscode需要保存后在运行才可以生效的(默认ctrl+s)
  4. 下午写的代码(h5+css+js)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .header{
            height: 100px;
            width: 100%;
        }
        .center{
            height: 400px;
            width: 100%;
        }
        .footer{
            height: 50px;
            width: 100%;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="center.css">
</head>
<body>
    <h1>Hello World!</h1>
    <div class = "header" style="background-color :red;">
        <label>header</label>
    </div>
    <div class = "center" style="background-color: yellow;">
        <div class = "left" style="background-color:purple">
            <label>left</label>
        </div>
        <div class = "right" style="background-color:brown">
            <label>right</label>
        </div>
    </div>
    <div class = "footer" id='footer' style="background-color: blue;">
        <label>footer</label>
        <input type="button"  onclick="clickme()" value="click me">
    </div>
    <script>
        function clickme(){
            document.getElementById('footer').style.backgroundColor='black';
        }
    </script>
</body>
</html>
.left{
    height: 100%;
    width: 20%;
    float: left;
}
.right{
    height: 100%;
    width: 70%;
    float: right;
}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值