Parent selector for zen-coding

不打扰是莪最后的温柔 提交于 2019-12-10 16:33:17

问题


I just discovered zen-coding.

I have the following snippet of code I want to generate.

<div id="base">
        <div id="header">
            <div id="logo"></div>
        </div>
        <div id="body"></div>
        <div id="footer"></div>         
</div>

Is there a way to do this with one line of zen-code

I know I can write

div#base>div#header>div#logo

this is where I get stuck, cause I don't know, how I can go back and add body and footer divs(siblings of header).

I want to figure out if/how this can be done in one line.

Thanks! :)


回答1:


This works for me with ZenCoding for Notepad++

div#base>(div#header>div#logo)+div#body+div#footer



回答2:


addition to Jonathon Bolster's answer:

other trick for climb up parent tag / tree:

  • you can using operator
  circumflex accent: ^ 

from emmet ( successor of zencoding )

source: http://docs.emmet.io/cheat-sheet/

  • or you can using
  less than symbol: < 

from sparkup ( fork of zencoding )

source: https://github.com/rstacruz/sparkup



来源:https://stackoverflow.com/questions/5132843/parent-selector-for-zen-coding

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!