Выбор всех прямых детей <ул.> элемент

Это свойственно зависящий от реализации, так как Стандарт не включает такую возможность. Для GCC cleanup атрибут выполняет функцию, когда переменная выходит из объема:

#include 

void scoped(int * pvariable) {
    printf("variable (%d) goes out of scope\n", *pvariable);
}

int main(void) {
    printf("before scope\n");
    {
        int watched __attribute__((cleanup (scoped)));
        watched = 42;
    }
    printf("after scope\n");
}

Печать:

before scope
variable (42) goes out of scope
after scope

См. здесь

6
задан Soliah 21 October 2009 в 08:38
поделиться

3 ответа

Use the child selector >:

ul > li { font-weight: bold; }

The only problem is that this doesn't work in IE6. See this list of CSS selectors and browser support.

If you need to support that browser you'll have to do something like this.

ul li { font-weight: bold; }
ul li li { font-weight: normal; }

This will be relatively straightforward in some situations and completely unworkable in others. If you find yourself in a difficult situation you may need to interpose some classes to make it easier.

9
ответ дан 9 December 2019 в 22:36
поделиться
ul > li

But it won't work in IE6. Here is a nice list of selector support in IE versions: http://www.smashingmagazine.com/2009/10/14/css-differences-in-internet-explorer-6-7-and-8/

The simplest way to explicitly target them is to give them a separate class name.

2
ответ дан 9 December 2019 в 22:36
поделиться

Что ж, если вы не беспокоитесь об использовании jQuery, вы можете решить проблему совместимости IE6, используя поддержку jQuery css.

0
ответ дан 9 December 2019 в 22:36
поделиться
Другие вопросы по тегам:

Похожие вопросы: