{"id":1123,"date":"2024-07-27T16:53:02","date_gmt":"2024-07-27T08:53:02","guid":{"rendered":"http:\/\/codermr.com\/?p=1123"},"modified":"2024-07-27T19:19:16","modified_gmt":"2024-07-27T11:19:16","slug":"css_article4","status":"publish","type":"post","link":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/","title":{"rendered":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 &#8211; \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u5143\u7d20\u5c45\u4e2d\u5bf9\u9f50<\/h1>\n\n\n\n<p>\u8981\u6c34\u5e73\u5c45\u4e2d\u5bf9\u9f50\u4e00\u4e2a\u5143\u7d20(\u5982 &lt;div&gt;), \u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>margin: auto;<\/strong>\u3002<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5230\u5143\u7d20\u7684\u5bbd\u5ea6\u5c06\u9632\u6b62\u5b83\u6ea2\u51fa\u5230\u5bb9\u5668\u7684\u8fb9\u7f18\u3002<\/p>\n\n\n\n<p>\u5143\u7d20\u901a\u8fc7\u6307\u5b9a\u5bbd\u5ea6\uff0c\u5e76\u5c06\u4e24\u8fb9\u7684\u7a7a\u5916\u8fb9\u8ddd\u5e73\u5747\u5206\u914d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt; \n&lt;style&gt;\n.center {\n    margin: auto;\n    width: 60%;\n    border: 3px solid #73AD21;\n    padding: 10px;\n}\n&lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&lt;div class=\"center\"&gt;\n  &lt;p&gt;&lt;b&gt;\u6ce8\u610f: &lt;\/b&gt;\u4f7f\u7528 margin:auto \u65e0\u6cd5\u517c\u5bb9 IE8, \u9664\u975e !DOCTYPE \u5df2\u7ecf\u58f0\u660e\u3002&lt;\/p&gt;\n&lt;\/div&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26.png\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"228\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26.png\" alt=\"\" class=\"wp-image-1124\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26.png 938w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26-300x73.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26-768x187.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-26-922x224.png 922w\" sizes=\"(max-width: 938px) 100vw, 938px\" \/><\/a><\/figure>\n\n\n\n<p><strong>\u6ce8\u610f:<\/strong>\u00a0<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e\u00a0width\u00a0\u5c5e\u6027(\u6216\u8005\u8bbe\u7f6e 100%)\uff0c\u5c45\u4e2d\u5bf9\u9f50\u5c06\u4e0d\u8d77\u4f5c\u7528\u3002<\/mark><\/strong><\/p>\n\n\n\n<p>\u518d\u5206\u6790\u4e0a\u9762\u7684 CSS \u5e03\u5c40\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-47.png\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"641\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-47.png\" alt=\"\" class=\"wp-image-1159\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-47.png 876w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-47-300x220.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-47-768x562.png 768w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/a><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0cdiv \u4e2d\u7684\u5185\u5bb9\uff0c\u53ea\u5360\u4e86 div \u5bbd\u5ea6\u7684 60% \uff0c\u4f60\u4e0d\u8981\u4ee5\u4e3a\u4f60\u770b\u5230\u7684\u8fd9 60% \u7684\u6587\u5b57\u5185\u5bb9\u5c31\u7b49\u540c\u4e8e div \u4e86\uff0c\u8fd9\u662f\u4e00\u4e2a\u5bb9\u6613\u72af\u7684\u9519\u8bef\uff01\uff01margin \u6240\u5360\u7684\u7a7a\u95f4\u662f\u900f\u660e\u7684\uff01<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u6587\u672c\u5c45\u4e2d\u5bf9\u9f50<\/h1>\n\n\n\n<p>\u5982\u679c\u4ec5\u4ec5\u662f\u4e3a\u4e86\u6587\u672c\u5728\u5143\u7d20\u5185\u5c45\u4e2d\u5bf9\u9f50\uff0c\u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>text-align: center;<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt; \n&lt;style&gt;\n.center {\n    text-align: center;\n    border: 3px solid green;\n}\n&lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&lt;div class=\"center\"&gt;\n  &lt;p&gt;div\u4e2d\u7684\u6587\u672c\u5c45\u4e2d\u5bf9\u9f50\u3002\u800cdiv\u672c\u8eab\u8fd8\u662f\u9ed8\u8ba4\u5c55\u793a\u7684\u3002&lt;\/p&gt;\n&lt;\/div&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u5982\u4e0a\uff0c\u8bbe\u7f6e\u4e86 div \u4e2d\u7684\u6587\u672c\u5c45\u4e2d\u5bf9\u9f50\u3002\u800c div \u672c\u8eab\u8fd8\u662f\u9ed8\u8ba4\u5c55\u793a\u7684\u3002\u5c55\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27.png\"><img loading=\"lazy\" decoding=\"async\" width=\"939\" height=\"152\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27.png\" alt=\"\" class=\"wp-image-1125\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27.png 939w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27-300x49.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27-768x124.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-27-922x149.png 922w\" sizes=\"(max-width: 939px) 100vw, 939px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u56fe\u7247\u5c45\u4e2d\u5bf9\u9f50<\/h1>\n\n\n\n<p>\u8981\u8ba9\u56fe\u7247\u5c45\u4e2d\u5bf9\u9f50, \u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>margin: auto;<\/strong>&nbsp;\u5e76\u5c06\u5b83\u653e\u5230&nbsp;<strong>\u5757<\/strong>&nbsp;\u5143\u7d20\u4e2d:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt; \n&lt;style&gt;\nimg {\n    display: block;\n    margin: 0 auto;\n}\n&lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&lt;p&gt;\u8981\u8ba9\u56fe\u7247\u5c45\u4e2d\u5bf9\u9f50, \u53ef\u4ee5\u4f7f\u7528 margin: auto; \u5e76\u5c06\u5b83\u653e\u5230\u5757\u5143\u7d20\u4e2d\uff1a&lt;\/p&gt;\n\n&lt;img src=\"https:\/\/static.jyshare.com\/images\/mix\/paris.jpg\" alt=\"Paris\" style=\"width:40%\"&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28.png\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"352\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28.png\" alt=\"\" class=\"wp-image-1126\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28.png 941w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28-300x112.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28-768x287.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-28-922x345.png 922w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u5de6\u53f3\u5bf9\u9f50 &#8211; \u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u5b9a\u4f4d\u65b9\u5f0f<\/h1>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>position: absolute;<\/strong>&nbsp;\u5c5e\u6027\u6765\u5bf9\u9f50\u5143\u7d20:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\uff081\uff09\u4f7f\u7528 position: absolute; \u548c right: 0px; \u5b9e\u73b0\u5143\u7d20\u53f3\u5bf9\u9f50\uff08position: absolute \u5219 right:0px \u624d\u4f1a\u751f\u6548\uff09\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-29.png\"><img loading=\"lazy\" decoding=\"async\" width=\"874\" height=\"466\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-29.png\" alt=\"\" class=\"wp-image-1128\" style=\"width:840px;height:auto\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-29.png 874w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-29-300x160.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-29-768x409.png 768w\" sizes=\"(max-width: 874px) 100vw, 874px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\uff082\uff09\u53d6\u6d88 position: absolute; \u540e\uff0cright: 0px; \u7684\u8bbe\u7f6e\u4f1a\u5931\u6548\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-30.png\"><img loading=\"lazy\" decoding=\"async\" width=\"861\" height=\"469\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-30.png\" alt=\"\" class=\"wp-image-1129\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-30.png 861w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-30-300x163.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-30-768x418.png 768w\" sizes=\"(max-width: 861px) 100vw, 861px\" \/><\/a><\/figure>\n\n\n\n<p>\u6ce8\u91ca\uff1a\u7edd\u5bf9\u5b9a\u4f4d\u5143\u7d20\u4f1a\u88ab\u4ece\u6b63\u5e38\u6d41\u4e2d\u5220\u9664\uff0c\u5e76\u4e14\u80fd\u591f\u4ea4\u53e0\u5143\u7d20\u3002<\/p>\n\n\n\n<p><strong>\u63d0\u793a:<\/strong>&nbsp;\u5f53\u4f7f\u7528&nbsp;<strong>position<\/strong>&nbsp;\u6765\u5bf9\u9f50\u5143\u7d20\u65f6, \u901a\u5e38&nbsp;<strong>&lt;body&gt;<\/strong>&nbsp;\u5143\u7d20\u4f1a\u8bbe\u7f6e&nbsp;<strong>margin<\/strong>&nbsp;\u548c&nbsp;<strong>padding<\/strong>&nbsp;\u3002 \u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5728\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\u4e2d\u51fa\u73b0\u53ef\u89c1\u7684\u5dee\u5f02\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u5de6\u53f3\u5bf9\u9f50 &#8211; \u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528 float \u65b9\u5f0f<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt; \n&lt;style&gt;\n.right {\n    float: right;\n    width: 300px;\n    border: 3px solid #73AD21;\n    padding: 10px;\n}\n&lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&lt;h2&gt;\u53f3\u5bf9\u9f50&lt;\/h2&gt;\n&lt;p&gt;\u4ee5\u4e0b\u5b9e\u4f8b\u6f14\u793a\u4e86\u4f7f\u7528 float \u5c5e\u6027\u6765\u5b9e\u73b0\u53f3\u5bf9\u9f50:&lt;\/p&gt;\n\n&lt;div class=\"right\"&gt;\n  &lt;p&gt;\u6211\u8001\u7239\u5728\u5c0f\u65f6\u5019\u7ed9\u6211\u7684\u4e00\u4e9b\u4eba\u751f\u5efa\u8bae\uff0c\u6211\u73b0\u5728\u8fd8\u8bb0\u5fc6\u6df1\u523b\u3002&lt;\/p&gt;\n&lt;\/div&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31.png\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"222\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31.png\" alt=\"\" class=\"wp-image-1130\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31.png 940w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31-300x71.png 300w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31-768x181.png 768w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-31-922x218.png 922w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/a><\/figure>\n\n\n\n<p>\u5f53\u50cf\u8fd9\u6837\u5bf9\u9f50\u5143\u7d20\u65f6\uff0c<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u5bf9 &lt;body&gt; \u5143\u7d20\u7684\u5916\u8fb9\u8ddd\u548c\u5185\u8fb9\u8ddd\u8fdb\u884c\u9884\u5b9a\u4e49\u662f\u4e00\u4e2a\u597d\u4e3b\u610f<\/mark><\/strong>\u3002\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5728\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\u4e2d\u51fa\u73b0\u53ef\u89c1\u7684\u5dee\u5f02\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u5b50\u5143\u7d20\u7684\u9ad8\u5ea6\u5927\u4e8e\u7236\u5143\u7d20\uff0c\u4e14\u5b50\u5143\u7d20\u8bbe\u7f6e\u4e86\u6d6e\u52a8\uff0c\u90a3\u4e48\u5b50\u5143\u7d20\u5c06\u6ea2\u51fa\uff0c\u8fd9\u65f6\u5019\u4f60\u53ef\u4ee5\u4f7f\u7528 &#8220;<strong>clearfix<\/strong>(\u6e05\u9664\u6d6e\u52a8)&#8221; \u6765\u89e3\u51b3\u8be5\u95ee\u9898\u3002<\/p>\n<\/blockquote>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5728\u7236\u5143\u7d20\u4e0a\u6dfb\u52a0 overflow: auto; \u6765\u89e3\u51b3\u5b50\u5143\u7d20\u6ea2\u51fa\u7684\u95ee\u9898:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.clearfix {\n    overflow: auto;\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50 &#8211; \u4f7f\u7528 padding<\/h1>\n\n\n\n<p>CSS \u4e2d\u6709\u5f88\u591a\u65b9\u5f0f\u53ef\u4ee5\u5b9e\u73b0\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50\u3002 \u4e00\u4e2a\u7b80\u5355\u7684\u65b9\u5f0f\u5c31\u662f\u5934\u90e8\u9876\u90e8\u4f7f\u7528&nbsp;<strong>padding<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.center {\n    padding: 70px 0;\n    border: 3px solid green;\n}<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-32.png\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"160\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-32.png\" alt=\"\" class=\"wp-image-1131\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-32.png 756w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-32-300x63.png 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><\/figure>\n\n\n\n<p>\u5982\u679c\u8981\u6c34\u5e73\u548c\u5782\u76f4\u90fd\u5c45\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>padding<\/strong>&nbsp;\u548c&nbsp;<strong>text-align: center<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.center {\n    padding: 70px 0;\n    border: 3px solid green;\n    text-align: center;\n}<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-33.png\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"160\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-33.png\" alt=\"\" class=\"wp-image-1132\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-33.png 756w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-33-300x63.png 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u5782\u76f4\u5c45\u4e2d &#8211; \u4f7f\u7528 line-height<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>.center {\n    line-height: 200px;\n    height: 200px;\n    border: 3px solid green;\n    text-align: center;\n}\n \n\/* \u5982\u679c\u6587\u672c\u6709\u591a\u884c\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801: *\/\n.center p {\n    line-height: 1.5;\n    display: inline-block;\n    vertical-align: middle;\n}<\/code><\/pre>\n\n\n\n<p>\u663e\u793a\u6548\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-34.png\"><img loading=\"lazy\" decoding=\"async\" width=\"755\" height=\"188\" src=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-34.png\" alt=\"\" class=\"wp-image-1133\" srcset=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-34.png 755w, http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/image-34-300x75.png 300w\" sizes=\"(max-width: 755px) 100vw, 755px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u66f4\u591a\u5b9e\u4f8b<\/h2>\n\n\n\n<p><a href=\"https:\/\/c.runoob.com\/codedemo\/3360\" target=\"_blank\" rel=\"noreferrer noopener\">CSS \u4f7f\u7528 margin \u8ba9 div \u5c45\u4e2d\u5bf9\u9f50<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/c.runoob.com\/codedemo\/3361\" target=\"_blank\" rel=\"noreferrer noopener\">CSS \u4f7f\u7528\u7edd\u5bf9\u5b9a\u4f4d \u8ba9 div \u53f3\u5bf9\u9f50<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5143\u7d20\u5c45\u4e2d\u5bf9\u9f50 \u8981\u6c34\u5e73\u5c45\u4e2d\u5bf9\u9f50\u4e00\u4e2a\u5143\u7d20(\u5982 &lt;div&gt;), \u53ef\u4ee5\u4f7f\u7528&nbsp;margin: au&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1127,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[61],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"\u5143\u7d20\u5c45\u4e2d\u5bf9\u9f50 \u8981\u6c34\u5e73\u5c45\u4e2d\u5bf9\u9f50\u4e00\u4e2a\u5143\u7d20(\u5982 &lt;div&gt;), \u53ef\u4ee5\u4f7f\u7528&nbsp;margin: au...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-27T08:53:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-27T11:19:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/css4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"\u7801\u5148\u751f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/mrcode2021\" \/>\n<meta name=\"twitter:site\" content=\"@mrcode2021\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7801\u5148\u751f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\"},\"author\":{\"name\":\"\u7801\u5148\u751f\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"headline\":\"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 &#8211; \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50\",\"datePublished\":\"2024-07-27T08:53:02+00:00\",\"dateModified\":\"2024-07-27T11:19:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\"},\"wordCount\":84,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"keywords\":[\"html_css_js\"],\"articleSection\":[\"\u524d\u7aef\u6280\u672f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\",\"url\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\",\"name\":\"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/#website\"},\"datePublished\":\"2024-07-27T08:53:02+00:00\",\"dateModified\":\"2024-07-27T11:19:16+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/codermr.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 &#8211; \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/codermr.com\/#website\",\"url\":\"http:\/\/codermr.com\/\",\"name\":\"\u7801\u5148\u751f\u7684\u535a\u5ba2\",\"description\":\"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP\",\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/codermr.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\",\"name\":\"\u7801\u5148\u751f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"contentUrl\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"width\":400,\"height\":400,\"caption\":\"\u7801\u5148\u751f\"},\"logo\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/codermr.com\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021\"],\"url\":\"http:\/\/codermr.com\/index.php\/author\/coderma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/","og_locale":"zh_CN","og_type":"article","og_title":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2","og_description":"\u5143\u7d20\u5c45\u4e2d\u5bf9\u9f50 \u8981\u6c34\u5e73\u5c45\u4e2d\u5bf9\u9f50\u4e00\u4e2a\u5143\u7d20(\u5982 &lt;div&gt;), \u53ef\u4ee5\u4f7f\u7528&nbsp;margin: au...","og_url":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/","og_site_name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","article_published_time":"2024-07-27T08:53:02+00:00","article_modified_time":"2024-07-27T11:19:16+00:00","og_image":[{"width":350,"height":350,"url":"http:\/\/codermr.com\/wp-content\/uploads\/2024\/07\/css4.png","type":"image\/png"}],"author":"\u7801\u5148\u751f","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/mrcode2021","twitter_site":"@mrcode2021","twitter_misc":{"\u4f5c\u8005":"\u7801\u5148\u751f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#article","isPartOf":{"@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/"},"author":{"name":"\u7801\u5148\u751f","@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"headline":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 &#8211; \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50","datePublished":"2024-07-27T08:53:02+00:00","dateModified":"2024-07-27T11:19:16+00:00","mainEntityOfPage":{"@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/"},"wordCount":84,"commentCount":0,"publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"keywords":["html_css_js"],"articleSection":["\u524d\u7aef\u6280\u672f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/","url":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/","name":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 - \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50 - \u7801\u5148\u751f\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/codermr.com\/#website"},"datePublished":"2024-07-27T08:53:02+00:00","dateModified":"2024-07-27T11:19:16+00:00","breadcrumb":{"@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/codermr.com\/index.php\/2024\/07\/27\/css_article4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/codermr.com\/"},{"@type":"ListItem","position":2,"name":"CSS \u57fa\u7840\uff08\u56db\uff09\uff1a\u5e03\u5c40 &#8211; \u6c34\u5e73 &amp; \u5782\u76f4\u5bf9\u9f50"}]},{"@type":"WebSite","@id":"http:\/\/codermr.com\/#website","url":"http:\/\/codermr.com\/","name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","description":"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP","publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/codermr.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf","name":"\u7801\u5148\u751f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/","url":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","contentUrl":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","width":400,"height":400,"caption":"\u7801\u5148\u751f"},"logo":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/codermr.com","https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021"],"url":"http:\/\/codermr.com\/index.php\/author\/coderma\/"}]}},"_links":{"self":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1123"}],"collection":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/comments?post=1123"}],"version-history":[{"count":2,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1123\/revisions"}],"predecessor-version":[{"id":1161,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1123\/revisions\/1161"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media\/1127"}],"wp:attachment":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media?parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/categories?post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/tags?post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}