Layering images in CSS - possible to put 2 images in same element?

后端 未结 8 875
你的背包
你的背包 2021-02-04 05:07

Supposing I\'m setting a background image for a web page in CSS like this:

body    {
font-size: 62.5%; /* Resets 1em to 10px */
font-family: Verdana, Arial, Sans         


        
相关标签:
8条回答
  • 2021-02-04 05:57

    Layered backgrounds are part of the CSS3 Working Draft but, as far as I know, support for them is limited to WebKit/KHTML-based browsers such as Safari, Chrome, Konqueror and OmniWeb.

    Using your example code, this would look like:

    body    {
        font-size: 62.5%; /* Resets 1em to 10px */
        font-family: Verdana, Arial, Sans-Serif;
        background-color: #9D5922;
        color: #000;
        margin-left: auto;
        margin-right: auto;
        margin: 0;
        padding: 0; 
        background: url("images/top.gif") left bottom repeat,
                    url("images/desk.gif") left bottom repeat;
    }
    
    0 讨论(0)
  • 2021-02-04 05:57

    The only way is to use another container. Each element may contain only one background image.

    0 讨论(0)
提交回复
热议问题