CSS: *html #id_name

后端 未结 2 1424
庸人自扰
庸人自扰 2021-01-17 04:42

I have this code

*html #alertBox {
    height:100px;
}

#modalContainer > #alertBox {
    position:fixed;
}

is this supported by css, i

2条回答
  •  攒了一身酷
    2021-01-17 04:47

    This is known as the star HTML hack and is useful in helping you pass certain CSS rules to older versions of Internet Explorer.

    So the first example will only set the height of #alertBox to 100 pixels if the browser that is used is susceptible to the star HTML hack:

    The second example (#modalContainer > #alertBox) will be applied to any element with an ID of alertBox which is also a direct child of another element that has an ID of modalContainer.

    The markup would have to look something like this:

    and not this:

    Both of these rules are valid CSS.

提交回复
热议问题