爲什麼在向內嵌div內的內容div添加文本後div不內聯?這是一個錯誤嗎? 在這裏我添加了我的代碼。我試着用jfiddle。但還沒有解決方案。添加文字後,div不會內聯
<div style="display:block">
<div style="width:230px; color:#000; background-color:#EAEAEA; border-radius:6px;display:inline-block; ">
<div style="text-transform:uppercase;font-size:14px;color:#000000;text-align:center;background-color:#FFFFFF;margin-top:6px;padding:5px;" class="font">
Colombo City
</div>
<div style="width:202px;height:202px;background-image:url(images/colombo.png);margin:14px;">
</div>
<div style="margin:14px;word-wrap:break-word;width:202px;height:200px;background-color:#0099CC;">
add more textadd more textadd more textadd more textadd more textadd more text
</div>
</div>
<div style="width:230px; color:#000; background-color:#EAEAEA; border-radius:6px; display:inline-block;margin-left:3px; ">
<div style="text-transform:uppercase;font-size:14px;color:#000000;text-align:center;background-color:#FFFFFF;margin-top:6px;padding:5px;" class="font">
Great Sigiriya
</div>
<div style="width:202px;height:202px;background-image:url(images/sigiriya.png);margin:14px;">
</div>
<div style="margin:14px;word-wrap:break-word;width:202px;height:200px;background-color:#0099CC;">
Colombo
</div>
</div>
<div style="width:230px; color:#000; background-color:#EAEAEA; border-radius:6px;display:inline-block;margin-left:3px; ">
<div style="text-transform:uppercase;font-size:14px;color:#000000;text-align:center;background-color:#FFFFFF;margin-top:6px;padding:5px;" class="font">
YALA National Park
</div>
<div style="width:202px;height:202px;background-image:url(images/hillcountry.png);margin:14px;">
</div>
<div style="margin:14px;word-wrap:break-word;width:202px;height:200px;background-color:#0099CC;">
Colombo
</div>
</div>
<div style="width:230px; color:#000; background-color:#EAEAEA; border-radius:6px; display:inline-block;margin-left:3px;">
<div style="text-transform:uppercase;font-size:14px;color:#000000;text-align:center;background-color:#FFFFFF;margin-top:6px;padding:5px;" class="font">
Arts & Crafts
</div>
<div style="width:202px;height:202px;background-image:url(images/crafts.png);margin:14px;">
</div>
<div style="margin:14px;word-wrap:break-word;width:202px;height:200px;background-color:#0099CC;">
Colombo
</div>
</div>
</div>
http://jsfiddle.net/ KABHH/ 這裏是從 – Ishani702 2013-02-25 13:41:00
ew。爲什麼不使用CSS?除此之外,問題究竟是什麼?你有沒有給容器足夠的寬度來實際適合你所有的元素? http://jsfiddle.net/KABHH/1/ – thescientist 2013-02-25 13:44:49
使用CSS樣式表,這是可讀的。不是說它必須對你的問題做任何事情,但它給你一個更好的觀點,然後內聯樣式 – 2013-02-25 13:45:13