0

如何将此对象输出格式化为水平列出而不是垂直列出?

for(var i=0; i<a; i++){
$('#{STORIES.story_id}6').append($('<div>', {text: sound[i].title}));
4

1 回答 1

1

This is not so much a JavaScript question than it is a HTML/CSS question. The output is vertical is most likely due to the use of <div> tag. It is a block level element, therefore there will always be space before and after this element. (Read more about block vs inline here: http://www.impressivewebs.com/difference-block-inline-css/ )

Try using an inline element. Eg. <span>

Keep in mind that in order to be valid markup, any inline level element must be contained in a block level element. Edit: To clarify, you can't have a block level element inside an inline level element.

于 2013-03-07T00:00:31.273 回答