【HTML+CSS】CSS基础2

1. 图片背景设置

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document </title>
    <style type="text/css">
        #bgstyle1 {width: 300px;height: 40px;border: 1px solid blue; 
            background-image: url(D:/素材/素材/3333.jpg);background-position: 0px -150px;}

            #bgstyle2
            {
                width: 300px;height: 40px;border: 1px solid blue;
                background-image: url(D:/素材/素材/4444.jpg);
                background-position: -60px -110px;

            }
    </style>
</head>

<body>
    <div id="bgstyle1">
    </div>
    <br>
    <div id="bgstyle2">
    </div>
</body>
</html>

2.图片美化

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document </title>
    <style type="text/css">
        img
        {
           border:5px solid blue;
           width: 110px;height: 120px; 
        }
    </style>
</head>

<body>
    <img src="D:/素材/素材/3333.jpg">
</body>
</html>

3.文本框美化

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document </title>
    <style type="text/css">
        .myinput1
        {
            border: 1px solid;
            border-radius: 2px;
            background-color: peachpuff;
            font-size: 14px;
        }
        .myinput2
        {
            border: 0px;
            border-bottom: 1px solid red;
            font-size: 14px;
        }
        
    </style>
</head>

<body>
    <div id="one">
        用户名:<input class="myinput1" type="text" name="userName" size="20"  /> <br/>
        密码:<input class="myinput2" type="password" name="userPwd" size="20" />
    </div>
</body>
</html>

4.按钮美化

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .imagebtn
        {
            background-image: url(D:/素材/icon/MSGBOX03.ICO);
            width:32px;height: 32px;border: 0px;
        }
    </style>
</head>

<body>
    
    <input type="button" name="btnBuy" class="imagebtn"/> <br/>

</body>
</html>

5.表格美化

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        .sellTable
        {
            border: 1px solid blue;border-collapse: collapse;
        }
        .sellTable caption
        {
            border: 1px solid blue;padding: 8px;background-color: aqua;font-size: 16px;letter-spacing: 5px;font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
        }
        .sellTable th
        {
            border: 1px solid blue;padding: 8px;background-color: blueviolet;
        }
        .sellTable td
        {
            border: 1px solid blue;padding: 6px; text-align: center;
        }
        .sellTable tr
        {
            background-color: rgb(196, 253, 255);

        }
    </style>
</head>

<body>
    <table class="sellTable">

        <caption> 学生成绩表</caption>
        <tr>
            <th>班级名称</th><th>姓名</th><th>总分</th>
        </tr>
        
        <tr>
            <td>软件1班</td><td>张晓晓</td><td>180</td>
        </tr>
        <tr>
            <td>软件1班</td><td>刘晓芬</td><td>175</td>
        </tr>
        <tr>
            <td>软件1班</td><td>王晓峰</td><td>185</td>
        </tr>
    
        <tr>
            <td>软件2班</td><td>杜晓丽</td><td>180</td>
        </tr>
        <tr>
            <td>软件2班</td><td>王晓丽</td><td>175</td>
        </tr>
        <tr>
            <td>软件2班</td><td>周晓丽</td><td>185</td>
        </tr>
    </table>

</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值