开发者

Make a <div> tag behave like a <br> tag with CSS

Is it possible to make a <div> tag behave like a stock <br> tag with CSS?

Are there any other tags that cannot be mimicke开发者_如何学God by styling a <div>?


add the style clear:both;


Yes, you can have a div do almost anything as long as you know exactly what properties to assign to it.

For a fake "br" tag (though I'm not sure why you would ever need this) you can set:

.classname {
height: 10px;
width:100%;
display:block;
position:relative;
}


Not exactly sure I understand the question, "behave like a <br />. You can define the display attribute of both.

display: inline | block;

That will determine a line break before and after either element.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜