{"id":2155,"date":"2018-12-18T10:26:07","date_gmt":"2018-12-18T02:26:07","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2155"},"modified":"2018-12-18T10:26:07","modified_gmt":"2018-12-18T02:26:07","slug":"css%e4%bd%bf%e7%94%a8displayinline-block%e6%9d%a5%e5%b8%83%e5%b1%80","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2155.html","title":{"rendered":"CSS\u4f7f\u7528display:inline-block\u6765\u5e03\u5c40"},"content":{"rendered":"
1.\u89e3\u91ca\u4e00\u4e0bdisplay\u7684\u51e0\u4e2a\u5e38\u7528\u7684\u5c5e\u6027\u503c\uff0cinline \uff0c block\uff0c inline-block<\/strong><\/p>\n \u56fe\u4e00: \u4e24\u4e2a\u56fe\u53ef\u4ee5\u770b\u51fa\uff0cdisplay\uff1ainline-block\u540e\u5757\u7ea7\u5143\u7d20\u80fd\u591f\u5728\u540c\u4e00\u884c\u663e\u793a\uff0c\u6709\u4eba\u8fd9\u8bf4\u4e0d\u5c31\u50cf\u6d6e\u52a8\u4e00\u6837\u5417\u3002\u6ca1\u9519\uff0cdisplay\uff1ainline-block\u7684\u6548\u679c\u51e0\u4e4e\u548c\u6d6e\u52a8\u4e00\u6837\uff0c\u4f46\u4e5f\u6709\u4e0d\u540c\uff0c\u63a5\u4e0b\u6765\u8bb2\u4e00\u4e0binline-block\u548c\u6d6e\u52a8\u7684\u6bd4\u8f83\u3002<\/p>\n <\/p>\n 2.inline-block\u5e03\u5c40 vs \u6d6e\u52a8\u5e03\u5c40<\/strong><\/p>\n \u00a0 \u00a0 a.\u4e0d\u540c\u4e4b\u5904\uff1a<\/strong>\u5bf9\u5143\u7d20\u8bbe\u7f6edisplay\uff1ainline-block \uff0c\u5143\u7d20\u4e0d\u4f1a\u8131\u79bb\u6587\u672c\u6d41\uff0c\u800cfloat\u5c31\u4f1a\u4f7f\u5f97\u5143\u7d20\u8131\u79bb\u6587\u672c\u6d41\uff0c\u4e14\u8fd8\u6709\u7236\u5143\u7d20\u9ad8\u5ea6\u574d\u584c\u7684\u6548\u679c<\/p>\n \u00a0 \u00a0 b.\u76f8\u540c\u4e4b\u5904\uff1a<\/strong>\u80fd\u5728\u67d0\u7a0b\u5ea6\u4e0a\u8fbe\u5230\u4e00\u6837\u7684\u6548\u679c<\/p>\n \u6211\u4eec\u5148\u6765\u770b\u770b\u8fd9\u4e24\u79cd\u5e03\u5c40\uff1a >>\u4e4d\u4e00\u770b\u4e24\u4e2a\u90fd\u80fd\u505a\u5230\u51e0\u4e4e\u76f8\u540c\u7684\u6548\u679c\uff0c\uff08\u4ed4\u7ec6\u770b\u770bdisplay\uff1ainline-block\u4e2d\u6709\u95f4\u9699\u95ee\u9898\uff0c\u8fd9\u4e2a\u7559\u5230\u4e0b\u9762\u518d\u8bb2\uff09<\/p>\n \u3000\u3000c.\u6d6e\u52a8\u5e03\u5c40\u4e0d\u592a\u597d\u7684\u5730\u65b9\uff1a<\/strong>\u53c2\u5dee\u4e0d\u9f50\u7684\u73b0\u8c61\uff0c\u6211\u4eec\u770b\u4e00\u4e2a\u6548\u679c\uff1a <\/p>\n 3.inline-block\u5b58\u5728\u7684\u5c0f\u95ee\u9898\uff1a<\/strong><\/p>\n \u3000\u3000a<\/strong>.\u4e0a\u9762\u53ef\u4ee5\u770b\u5230\u7528\u4e86display:inline-block\u540e\uff0c\u5b58\u5728\u95f4\u9699\u95ee\u9898\uff0c\u95f4\u9699\u4e3a4\u50cf\u7d20\uff0c\u8fd9\u4e2a\u95ee\u9898\u4ea7\u751f\u7684\u539f\u56e0\u662f\u6362\u884c\u5f15\u8d77\u7684\uff0c\u56e0\u4e3a\u6211\u4eec\u5199\u6807\u7b7e\u65f6\u901a\u5e38\u4f1a\u5728\u6807\u7b7e\u7ed3\u675f\u7b26\u540e\u987a\u624b\u6253\u4e2a\u56de\u8f66\uff0c\u800c\u56de\u8f66\u4f1a\u4ea7\u751f\u56de\u8f66\u7b26\uff0c\u56de\u8f66\u7b26\u76f8\u5f53\u4e8e\u7a7a\u767d\u7b26\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u591a\u4e2a\u8fde\u7eed\u7684\u7a7a\u767d\u7b26\u4f1a\u5408\u5e76\u6210\u4e00\u4e2a\u7a7a\u767d\u7b26\uff0c\u800c\u4ea7\u751f\u201c\u7a7a\u767d\u95f4\u9699\u201d\u7684\u771f\u6b63\u539f\u56e0\u5c31\u662f\u8fd9\u4e2a\u8ba9\u6211\u4eec\u5e76\u4e0d\u600e\u4e48\u6ce8\u610f\u7684\u7a7a\u767d\u7b26\u3002<\/p>\n <\/p>\n \u3000\u3000b.<\/strong>\u53bb\u9664\u7a7a\u9699\u7684\u65b9\u6cd5\uff1a <\/p>\n \u3000\u3000c.<\/strong>\u6d4f\u89c8\u5668\u517c\u5bb9\u6027\uff1aie6\/7\u662f\u4e0d\u517c\u5bb9 display\uff1ainline-block\u7684\u6240\u4ee5\u8981\u989d\u5916\u5904\u7406\u4e00\u4e0b\uff1a <\/p>\n 4.\u603b\u7ed3:<\/strong><\/p>\n display\uff1ainline-block\u7684\u5e03\u5c40\u65b9\u5f0f\u548c\u6d6e\u52a8\u7684\u5e03\u5c40\u65b9\u5f0f\uff0c\u7a76\u7adf\u4f7f\u7528\u54ea\u4e2a\uff0c\u6211\u89c9\u5f97\u5e94\u8be5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u6765\u51b3\u5b9a\u7684\uff1a <\/p>\n \u4f5c\u8005\uff1aRy-yuan<\/p>\n","protected":false},"excerpt":{"rendered":" 1.\u89e3\u91ca\u4e00\u4e0bdisplay\u7684\u51e0\u4e2a\u5e38\u7528\u7684\u5c5e\u6027\u503c\uff0cinline \uff0c block\uff0c inline-block inl […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[205,726,727],"class_list":["post-2155","post","type-post","status-publish","format-standard","hentry","category-web","tag-css","tag-displayinline-block","tag-727"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=2155"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2155\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
\n
\n
\n
\n<\/a>
\n\u56fe\u4e8c\uff1a
\n<\/a><\/p>\n
\n\u56fe\u4e00\uff1adisplay\uff1ainline-block
\n<\/a>
\n\u56fe\u4e8c\uff1a\u5bf9\u4e24\u4e2a\u5b69\u5b50\u4f7f\u7528float\uff1aleft\uff0c\u6211\u5728\u4e0a\u4e00\u7bc7\u6d6e\u52a8\u5e03\u5c40\u8bb2\u8fc7\uff0c\u8fd9\u662f\u7236\u5143\u7d20\u4f1a\u9ad8\u5ea6\u574d\u584c\uff0c\u6240\u4ee5\u8981\u95ed\u5408\u6d6e\u52a8\uff0c\u5bf9box\u4f7f\u7528overflow\uff1ahidden\uff0c\u6548\u679c\u5982\u4e0b\uff1a
\n<\/a><\/p>\n
\n\u56fe\u4e09\uff1a
\n<\/a>
\n\u56fe\u56db\uff1a
\n<\/a>
\n>>\u4ece\u56fe3,4\u53ef\u4ee5\u770b\u51fa\u6d6e\u52a8\u7684\u5c40\u9650\u6027\u5728\u4e8e\uff0c\u82e5\u8981\u5143\u7d20\u6392\u6ee1\u4e00\u884c\uff0c\u6362\u884c\u540e\u8fd8\u8981\u6574\u9f50\u6392\u5217\uff0c\u5c31\u8981\u5b50\u5143\u7d20\u7684\u9ad8\u5ea6\u4e00\u81f4\u624d\u884c\uff0c\u4e0d\u7136\u5c31\u4f1a\u51fa\u73b0\u56fe\u4e09\u7684\u6548\u679c\uff0c\u800cinline-block\u5c31\u4e0d\u4f1a\u3002<\/p>\n
\n1.\u5bf9\u7236\u5143\u7d20\u6dfb\u52a0\uff0c{font-size:0}\uff0c\u5373\u5c06\u5b57\u4f53\u5927\u5c0f\u8bbe\u4e3a0\uff0c\u90a3\u4e48\u90a3\u4e2a\u7a7a\u767d\u7b26\u4e5f\u53d8\u62100px\uff0c\u4ece\u800c\u6d88\u9664\u7a7a\u9699
\n\u73b0\u5728\u8fd9\u79cd\u65b9\u6cd5\u5df2\u7ecf\u53ef\u4ee5\u517c\u5bb9\u5404\u79cd\u6d4f\u89c8\u5668\uff0c\u4ee5\u524dchrome\u6d4f\u89c8\u5668\u662f\u4e0d\u517c\u5bb9\u7684
\n\u56fe\u4e00\uff1a
\n<\/a><\/p>\n
\n\u5728ie6\/7\u4e0b\uff1a
\n\u5bf9\u4e8e\u884c\u5185\u5143\u7d20\u76f4\u63a5\u4f7f\u7528{dislplay:inline-block;}
\n\u5bf9\u4e8e\u5757\u7ea7\u5143\u7d20\uff1a\u9700\u6dfb\u52a0{display:inline;zoom:1;}<\/p>\n
\na.\u5bf9\u4e8e\u6a2a\u5411\u6392\u5217\u4e1c\u897f\u6765\u8bf4\uff0c\u6211\u66f4\u503e\u5411\u4e0e\u4f7f\u7528inline-block\u6765\u5e03\u5c40\uff0c\u56e0\u4e3a\u8fd9\u6837\u6e05\u6670\uff0c\u4e5f\u4e0d\u7528\u518d\u50cf\u6d6e\u52a8\u90a3\u6837\u6e05\u9664\u6d6e\u52a8\uff0c\u5bb3\u6015\u5e03\u5c40\u6df7\u4e71\u7b49\u7b49\u3002
\nb.\u5bf9\u4e8e\u6d6e\u52a8\u5e03\u5c40\u5c31\u7528\u4e8e\u9700\u8981\u6587\u5b57\u73af\u7ed5\u7684\u65f6\u5019\uff0c\u6bd5\u7adf\u8fd9\u624d\u662f\u6d6e\u52a8\u771f\u6b63\u7684\u7528\u6b66\u4e4b\u5730\uff0c\u6c34\u5e73\u6392\u5217\u7684\u662f\u5c31\u4ea4\u7ed9inline-block\u4e86\u3002<\/p>\n