开发者

Show div structure of page in a diagram

Is there a way to show the div structure of a website with "blocks" that don't have the conten开发者_如何转开发t within. Like just boxes to show where the divs are positionally and relationally. I have firebug and web dev, but they don't just outline the div like that.


very basic outlining using jQuery (you can run this on this page if you like):

var $body = $(document.body);

$('div').each(function(){
    var $this = $(this),
       offset = $this.offset(),
        width = $this.outerWidth(),
       height = $this.outerHeight()

    $body.append(
        $('<div style="position:absolute;border:1px solid #00F;background:#99F;opacity:.3;"></div>')
        .css(offset)
        .css({ width: width, height: height })
    );
});

if you don't need to see depths (handled by transparency here), just do:

div {
    outline : 1px solid #00F;
}


I usually use outline to do this. Functions like border but without affecting layout widths:

div { outline: 1px solid red; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜