问题
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