今日会社の後輩くんから「display: inline-blockを使ってliを横並びにしてるんですけど、隙間ができてしまうんですが…」との質問。 彼は最近HTMLを学び始めたばかりなんですが、自分も昔これでmarginとかいじくり倒して悩んだことがあり、みんな同じ壁にぶち当たるもんなんだなぁとしみじみ…。 display: inline-blockでliを横並びに <ul> <li>box1</li> <li>box2</li> <li>box3</li> </ul> li { display: inline-block; /* IE 6/7 */ /display: inline; /zoom: 1; width: 100px; height: 100px; border: 1px solid #ccc; list-style: none; text-align: center; li