首页 话题 小组 问答 好文 用户 我的社区 域名交易 唠叨

[分享]css中常用行为有哪些

发布于 2024-11-11 19:11:01
0
11

在CSS中,常用到的行为包括:

 /* 选择器 */
    .class {
        /* 属性 */
        color: red;
    }

    /* 盒子模型 */
    .box {
        width: 200px;
        height: 200px;
        padding: 10px;
        border: 1px solid black;
        margin: 20px;
    }

    /* 盒子布局 */
    .container {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* 文本样式 */
    p {
        font-size: 18px;
        font-weight: bold;
        line-height: 1.5;
        text-align: center;
        text-shadow: 1px 1px black;
    }

    /* 背景样式 */
    body {
        background-color: gray;
        background-image: url('bg.jpg');
        background-size: cover;
    }

    /* 动画效果 */
    .animation {
        animation-name: fade-in;
        animation-duration: 2s;
    }

    @keyframes fade-in {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    } 

以上是CSS中常用的行为,开发者可根据需要进行选择和使用,以达到最佳的视觉效果。

评论
一个月内的热帖推荐
91云脑
Lv.1普通用户

62849

帖子

14

小组

291

积分

赞助商广告
站长交流