如何将此对象输出格式化为水平列出而不是垂直列出?
for(var i=0; i<a; i++){
$('#{STORIES.story_id}6').append($('<div>', {text: sound[i].title}));
如何将此对象输出格式化为水平列出而不是垂直列出?
for(var i=0; i<a; i++){
$('#{STORIES.story_id}6').append($('<div>', {text: sound[i].title}));
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.