问答详情
源自:1-2 佛靠金装,人靠衣装 - html和css的关系

颜色好像看不到显示效果和具中

颜色好像看不到显示效果和具中

提问者:qq_风信子_26 2017-11-02 22:33

个回答

  • px啊哈哈
    2017-11-06 16:58:27

    <!DOCTYPE HTML>

    <html>

        <head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

            <title>Html和CSS的关系</title>

            <style type="text/css">

            h1{

                font-size:12px;

                color:red;

                text-align:center;

                background-color:blue;


            }

            </style>

        </head>

        <body>

            <h1>Hello World!</h1>

        </body>

    </html>

    加了一个背景颜色为蓝色background-color:blue;

  • 慕UI3735678
    2017-11-04 17:14:56

    <!DOCTYPE HTML>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Html和CSS的关系</title>
            <style type="text/css">
            h1{
               display:block;
                font-size:12px;
                color:red;
                text-align:center;
            }
            </style>
        </head>
        <body>
            <h1>Hello World!</h1>
        </body>
    </html>
    color是字体颜色,背景颜色是background,或者把h1标签设置成块元素试试,在css里面加上display:block;


  • 冷眼下瞰
    2017-11-02 22:53:52

    <!DOCTYPE HTML>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Html和CSS的关系</title>
            <style type="text/css">
            h1{
                font-size:12px;
                color:#930;
                text-align:center;
            }
            </style>
        </head>
        <body>
            <h1>Hello World!</h1>
        </body>
    </html>


  • qq_心宽何处不是晴天_0
    2017-11-02 22:51:44

    <!DOCTYPE HTML>

    <html>

        <head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

            <title>Html和CSS的关系</title>

            <style type="text/css">

            h1{

                font-size:12px;

                color:red;

                text-align:center;



            }

            </style>

        </head>

        <body>

            <h1>Hello World!</h1>

        </body>

    </html>