css学习代码-文本、链接、边框

文本居中:

<html>
    <head>
        <title>css文本</title>
        <style type="text/css">
            table{
                text-align:center ;
            }
        </style>
    </head>
    
    <body>
        <table border="1" width="80%">
            <tr>
                <td>学号</td>
                <td>姓名</td>
            </tr>
            <tr>
                <td>007</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>008</td>
                <td>李四</td>
            </tr>
        </table>
    </body>
</html>

下划线:

<html>
    <head>
        <title>css文本</title>
        <style type="text/css">
            p{
                text-decoration:underline ;
            }
        </style>
    </head>
    
    <body>
        <p>    
            下划线
        </p>
    </body>
</html>

伪类 链接:

<html>
    <head>
        <title>css文本</title>
        <style type="text/css">
            /*
                link:将从未访问过的链接设置红色
                visited:将已经访问过的链接设置绿色
                active:将当前得到焦点的链接设置为黄色
                hover:当鼠标悬停在链接上设置为橘黄色,斜体,字大小30px,间距20px
            */
            a:link{
                color:red ;
            }
            a:visited{
                color:green ;
            }
            a:active{
                color:yellow ;
            }
            a:hover{
                color:orange ;
                font-style:italic ;
                font-size:30px ;
                letter-spacing:20px ;
            }
        </style>
    </head>
    
    <body>
        <a href="#">link</a><p>
        <a href="#">visited</a><p>
        <a href="#">active</a><p>
        <a href="#">hover</a><p>
    </body>
</html>

去除下划线

<html>
    <head>
        <title>css文本</title>
        <style type="text/css">
            /*
                link:将从未访问过的链接设置红色
                visited:将已经访问过的链接设置绿色
                active:将当前得到焦点的链接设置为黄色
                hover:当鼠标悬停在链接上设置为橘黄色,斜体,字大小30px,间距20px
                去除下划线
            */
            a{
                text-decoration:none ;
            }
            a:link{
                color:red ;
            }
            a:visited{
                color:green ;
            }
            a:active{
                color:yellow ;
            }
            a:hover{
                color:orange ;
                font-style:italic ;
                font-size:30px ;
                letter-spacing:20px ;
            }
        </style>
    </head>
    
    <body>
        <a href="#">link</a><p>
        <a href="#">visited</a><p>
        <a href="#">active</a><p>
        <a href="#">hover</a><p>
    </body>
</html>

边框:

<html>
    <head>
        <title>css文本</title>
        <style type="text/css">
            table{
                border:1px solid black ;
                border-collapse:collapse ;
            }
            td{
                border:1px solid black ;
                border-collapse:collapse ;
            }
        </style>
    </head>
    
    <body>
        <table border="1" width="80%">
            <tr>
                <td>学号</td>
                <td>姓名</td>
            </tr>
            <tr>
                <td>007</td>
                <td>张三</td>
            </tr>
            <tr>
                <td>008</td>
                <td>李四</td>
            </tr>
        </table>
    </body>
</html>


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值