Select specific element before other element

后端 未结 5 1672
刺人心
刺人心 2020-12-06 04:41

I have following HTML structure:

Candy jelly-o jelly beans gummies lollipop

Cupcake ipsum dolor sit amet.

5条回答
  •  一个人的身影
    2020-12-06 04:59

    The rule h2~ul will not select h2 but ul. So you will not be able to apply any style to h2.

    CSS element1~element2

    I have the same problem with panel location. I have a element that is followed by a . And in this case I would like to reduce the height or the min-height (depends on the panels are fixed or not) of the main panel by style application.

    In case of fixed footer, because I can declare the element before the main in my html file (it will be relocated by top/left properties) I can use the ~ selector like this: footer ~ main. But in case of non fixed footer, the only way I found is to add a class at document.ready() call.

提交回复
热议问题