{"id":2191,"date":"2012-02-14T16:35:10","date_gmt":"2012-02-14T08:35:10","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=2191"},"modified":"2018-01-02T01:21:04","modified_gmt":"2018-01-01T17:21:04","slug":"css-overflow-hidden-visibility-hidden-disabled-use","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2012\/02\/css-overflow-hidden-visibility-hidden-disabled-use\/","title":{"rendered":"\u60a8\u53ef\u80fd\u4e0d\u77e5\u9053\u7684CSS\u5143\u7d20\u9690\u85cf\u201c\u5931\u6548\u201d\u4ee5\u5176\u5999\u7528"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=2191\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=2191<\/a><\/p>\n<h3>\u4e00\u3001CSS\u5143\u7d20\u9690\u85cf<\/h3>\n<p>\u5728CSS\u4e2d\uff0c\u8ba9\u5143\u7d20\u9690\u85cf\uff08\u6307\u5c4f\u5e55\u8303\u56f4\u5185\u8089\u773c\u4e0d\u53ef\u89c1\uff09\u7684\u65b9\u6cd5\u5f88\u591a\uff0c\u6709\u7684\u5360\u636e\u7a7a\u95f4\uff0c\u6709\u7684\u4e0d\u5360\u636e\u7a7a\u95f4\uff1b\u6709\u7684\u53ef\u4ee5\u54cd\u5e94\u70b9\u51fb\uff0c\u6709\u7684\u4e0d\u80fd\u54cd\u5e94\u70b9\u51fb\u3002\u540e\u5bab\u9009\u79c0\u2014\u2014\u4e00\u4e2a\u4e00\u4e2a\u770b\u3002<\/p>\n<div class=\"zxx_code\">\n<pre>{ display: none; <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ visibility: hidden; <span style=\"color:green;\">\/* \u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ position: absolute; clip:rect(1px 1px 1px 1px); <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ position: absolute; top: -999em; <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ position: relative; top: -999em; <span style=\"color:green;\">\/* \u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ position: absolute; visibility: hidden; <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ height: 0; overflow: hidden; <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ opacity: 0; filter:Alpha(opacity=0); <span style=\"color:green;\">\/* \u5360\u636e\u7a7a\u95f4\uff0c\u53ef\u4ee5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ position: absolute; opacity: 0; filter:Alpha(opacity=0); <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u53ef\u4ee5\u70b9\u51fb *\/<\/span> }<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{ \n    zoom: 0.001;\n    -moz-transform: scale(0);\n    -webkit-transform: scale(0);\n    -o-transform: scale(0);\n    transform: scale(0);\n    <span style=\"color:green;\">\/* IE6\/IE7\/IE9\u4e0d\u5360\u636e\u7a7a\u95f4\uff0cIE8\/FireFox\/Chrome\/Opera\u5360\u636e\u7a7a\u95f4\u3002\u90fd\u65e0\u6cd5\u70b9\u51fb *\/<\/span>\n}<\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>{\n    position: absolute;\n    zoom: 0.001;\n    -moz-transform: scale(0);\n    -webkit-transform: scale(0);\n    -o-transform: scale(0);\n    transform: scale(0); \n    <span style=\"color:green;\">\/* \u4e0d\u5360\u636e\u7a7a\u95f4\uff0c\u65e0\u6cd5\u70b9\u51fb *\/<\/span>\n}<\/pre>\n<\/div>\n<p><strong>\u6b22\u8fce\u8865\u5145\uff01<\/strong><\/p>\n<p>\u4ee5\u4e0a\u9690\u85cf\u65b9\u6cd5\u5982\u679c\u9488\u5bf9\u6700\u5c0f\u8f88\u7684\u5b50\u5143\u7d20\uff08\u819d\u4e0b\u65e0\u5b50\u5973\uff09\uff0c\u4f8b\u5982<code>&lt;img&gt;<\/code>\u56fe\u7247\u5143\u7d20\uff0c\u5219\u4e0a\u9762\u7684\u6ce8\u91ca\u8bf4\u660e\u90fd\u662fOK\u7684(\u82e5\u6709\u8bef\uff0c\u8bf7\u6307\u6b63)\u3002<\/p>\n<p>\u6211\u4ee5\u524d\u5c31\u63d0\u8fc7\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u7406\u89e3\uff0c\u6211\u4eec\u4f1a\u4f7f\u7528\u60c5\u611f\u5316\u601d\u7ef4\uff0c\u7c7b\u6bd4\u73b0\u5b9e\uff0c\u5728\u5185\u5fc3\u5f62\u6210\u53ea\u5c5e\u4e8e\u81ea\u5df1\u7684\u5177\u8c61\u5316\u7684\u60f3\u6cd5\u3002\u8fd9\u662f\u5f88OK\u7684\uff0c\u4f46\u662f\uff0c\u8981\u77e5\u9053\uff0c\u4e8b\u7269\u662f\u5177\u6709\u4e24\u9762\u7684\uff0c\u5177\u8c61\u7684\u4e1c\u897f\u5bb9\u6613\u8ba9\u6211\u4eec\u9677\u5165\u56fa\u5b9a\u601d\u7ef4\u6a21\u5f0f\uff0c\u5c24\u5176\u5728\u73b0\u5b9e\u4e16\u754c\u4e2d\u975e\u7279\u6b8a\u60c5\u5883\u7684\u9a8c\u8bc1\u4e0b\uff0c\u4ece\u800c\u8ba9\u6211\u4eec\u4e0d\u7ecf\u610f\u95f4\u4ea7\u751f\u4e00\u4e9b\u9519\u8bef\u7684\u8ba4\u8bc6\u3002<\/p>\n<p>\u4e0a\u9762\u7684\u8bdd\u6709\u70b9\u50cf\u8001\u6cb9\u6761\u2014\u2014\u96be\u56bc\u3002\u8981\u8ba9\u8001\u5c11\u7686\u61c2\uff0c\u5f88\u7b80\u5355\uff0c\u4e3e\u51e0\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u5c31\u53ef\u4ee5\u4e86\u3002\u800c\u8fd9\u91cc\u7684\u793a\u4f8b\u5c31\u662f\u4e0a\u5934\u51e0\u4e2a\u9690\u85cf\u7684\u4f8b\u5b50\uff1a\u7531\u4e8e\u5177\u8c61\u5316\u7684\u56fa\u5b9a\u601d\u7ef4\uff0c\u60a8\u53ef\u80fd\u5e76\u4e0d\u77e5\u9053\u4e0b\u9762\u8981\u63d0\u5230\u7684\u51e0\u79cdCSS\u5143\u7d20\u9690\u85cf\u201c\u5931\u6548\u201d\u7684\u60c5\u51b5\uff01<\/p>\n<h3>\u4e8c\u3001display:none\u548cvisibility:hidden<\/h3>\n<p>\u6211\u8bb0\u5f97\u6821\u56ed\u62db\u8058\u90a3\u4f1a\u513f\uff0c\u6280\u672f\u9762\u7684\u65f6\u5019\u6709\u95ee\u6211<code>display:none<\/code>\u548c<code>visibility:hidden<\/code>\u7684\u533a\u522b\u5728\u54ea\u513f\uff1f<\/p>\n<p>\u201c\u8fd9\u4e2a\u95ee\u9898\u7b80\u5355\uff1f\u201d\u6211\u5fc3\u91cc\u5934\u6697\u81ea\u5f97\u610f\uff0c\u6309\u8010\u4f4f\u81ea\u5df1\u5f97\u610f\u53c8\u7d27\u5f20\u7684\u5c0f\u5fc3\u810f\uff0c\u81ea\u4fe1\u6ee1\u6ee1\u5730\u8bf4\uff0c\u201c\u8fd9\u4e24\u4e2a\u58f0\u660e\u90fd\u53ef\u4ee5\u8ba9\u5143\u7d20\u9690\u85cf\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e<code>display:none<\/code>\u9690\u85cf\u540e\u7684\u5143\u7d20\u4e0d\u5360\u636e\u4efb\u4f55\u7a7a\u95f4\uff0c\u800c<code>visibility:hidden<\/code>\u9690\u85cf\u7684\u5143\u7d20\u7a7a\u95f4\u4f9d\u65e7\u5b58\u5728\u3002\u201d<\/p>\n<p>\u60f3\u5728\u60f3\u60f3\uff0c\u81ea\u5df1\u5b9e\u5728\u662f\u6d6e\u8e81\u4e86\u70b9\u3002\u8fd9\u79cd\u7a0b\u5ea6\u7684\u7b54\u6848\u8bf4\u660e\u4f60\u5728HTML\/CSS\u65b9\u9762\u7684\u9020\u8be3\u53ea\u662f\u4e86\u89e3\u8fd9\u4e2a\u5c42\u9762\uff0c\u5e76\u4e0d\u80fd\u8ba9\u9762\u8bd5\u5b98\u773c\u524d\u4e00\u4eae\u3002\u653e\u773c\u6574\u4e2a\u4e2d\u56fd\uff0c\u5199\u9875\u9762\u7684\u4eba\u4f55\u5176\u591a\uff0c\u50cf\u8fd9\u79cd\u7a0b\u5ea6\u56de\u7b54\u7684\u4eba\u4e00\u5b9a\u5c31\u50cf\u6cb3\u91cc\u7684\u6c99\u5b50\u4e00\u6837\uff0c\u4e00\u6293\u4e00\u5927\u628a\u3002\u968f\u4fbf\u7528\u811a\u8dbe\u5934\u60f3\u60f3\u4e5f\u77e5\u9053\uff0c\u50cf\u5ea6\u5a18\uff0c\u4f01\u9e45\u516c\u53f8\u82b1\u8d39\u90a3\u4e48\u591a\u4eba\u529b\u548c\u8d22\u529b\u6765\u6821\u56ed\u662f\u80af\u5b9a\u6765\u6311\u91d1\u5b50\u7684\uff0c\u4e0d\u8d77\u773c\u7684\u6c99\u5b50\u5c31\u8ba9\u5b83\u968f\u6ce2\u9010\u6d41\uff0c\u6d41\u5230\u5927\u6d77\u6696\u5316\u77f3\u53bb\u5427\u3002<\/p>\n<p>\u76ee\u524d\uff0c\u6211\u6240\u77e5\u9053\u7684\u4e0d\u540c\u6709\u4e09\u70b9\uff08\u6b22\u8fce\u8865\u5145\uff09\uff1a<\/p>\n<ol>\n<li>\u7a7a\u95f4\u5360\u636e<\/li>\n<li>\u56de\u6d41\u4e0e\u6e32\u67d3<\/li>\n<li>\u682a\u8fde\u6027<\/li>\n<\/ol>\n<p>\u7b2c\u4e00\u70b9\uff0c\u60f3\u5fc5\u90fd\u77e5\u9053\uff1b\u7b2c\u4e8c\u70b9\u6211\u4e4b\u524d\u6709<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?s=%E5%9B%9E%E6%B5%81\">\u591a\u7bc7\u8bd1\u6587<\/a>\u63d0\u8fc7\uff0c<code>display:none<\/code>\u9690\u85cf\u4ea7\u751freflow\u548crepaint(\u56de\u6d41\u4e0e\u91cd\u7ed8)\uff0c\u800c<code>visibility:hidden<\/code>\u6ca1\u6709\u8fd9\u4e2a\u5f71\u54cd\u524d\u7aef\u6027\u80fd\u7684\u95ee\u9898\uff1b\u7b2c\u4e09\u70b9\u4f30\u8ba1\u662f\u4e0d\u5c11\u540c\u884c\u4e0d\u77e5\u9053\u7684\uff0c\u5c31\u662f\u201c\u682a\u8fde\u6027\u201d\u65b9\u9762\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u6240\u8c13\u201c\u682a\u8fde\u6027\u201d\uff0c\u5c31\u662f\u5982\u679c\u7956\u5148\u5143\u7d20\u906d\u9047\u67d0\u7978\u5bb3\uff0c\u5219\u5176\u5b50\u5b50\u5b59\u5b59\u65e0\u4e00\u4f8b\u5916\u4e5f\u8981\u906d\u6b83\u3002\u6211\u987f\u65f6\u60f3\u8d77\u4e86\u300a\u5730\u7403\u53cd\u51fb\u6218\u300b\u6216\u662f\u300a\u6728\u4e43\u4f0a\u4e4b\u874e\u5b50\u738b\u300b\uff0c\u4e00\u65e6\u628a\u6bcd\u4f53\u641e\u8ddb\u4e86\uff0c\u5c0f\u8f88\u554a\u3001\u4e0b\u5c5e\u554a\u4ec0\u4e48\u7684\u90fd\u77ac\u95f4\u70df\u6d88\u4e91\u6563\u3002<code>display:none<\/code>\u5c31\u662f\u201c\u682a\u8fde\u6027\u201d\u660e\u663e\u7684\u58f0\u660e\uff1a\u4e00\u65e6\u7236\u8282\u70b9\u5143\u7d20\u5e94\u7528\u4e86<code>display:none<\/code>\uff0c\u7236\u8282\u70b9\u53ca\u5176\u5b50\u5b59\u8282\u70b9\u5143\u7d20\u5168\u90e8\u4e0d\u53ef\u89c1\uff0c\u800c\u4e14\u65e0\u8bba\u5176\u5b50\u5b59\u5143\u7d20\u5982\u4f55\u4e0d\u5c48\u5730\u6323\u624e\u90fd\u65e0\u6d4e\u4e8e\u4e8b\u3002<\/p>\n<p>\u5728\u5b9e\u9645\u7684web\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u8981\u7ecf\u5e38\u5b9e\u73b0\u4e00\u4e9b\u663e\u793a\u9690\u85cf\u7684\u529f\u80fd\uff0c\u7531\u4e8e<code>display:none<\/code>\u672c\u8eab\u7279\u6027\u4ee5\u53cajQuery\u6f5c\u5728\u7684\u9a71\u52a8\uff0c\u4f7f\u5f97\u6211\u4eec\u5bf9<code>display:none<\/code>\u8fd9\u79cd\u9690\u85cf\u7279\u6027\u76f8\u5f53\u719f\u77e5\u3002\u56e0\u6b64\uff0c\u4e45\u800c\u4e45\u4e4b\u4f1a\u5f62\u6210\u6bd4\u8f83\u7262\u56fa\u7684\u60c5\u611f\u5316\u8ba4\u8bc6\uff0c\u5e76\u65e0\u6cd5\u907f\u514d\u5730\u5c06\u8fd9\u79cd\u8ba4\u8bc6\u8fc1\u79fb\u5230\u5176\u4ed6\u7c7b\u4f3c\u8868\u73b0\u5c5e\u6027(eg. <code>visibility<\/code>)\u7684\u8ba4\u8bc6\u4e0a\uff0c\u518d\u52a0\u4e0a\u4e00\u4e9b\u5e38\u89c4\u7ecf\u9a8c\u2026\u2026<\/p>\n<p>\u4e3e\u4f8b\u6765\u8bf4\u5427\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7ed9\u4e00\u4e2a\u7236\u5143\u7d20\u5e94\u7528<code>visibility:hidden<\/code>\uff0c\u5219\u5176\u5b50\u5b59\u540e\u4ee3\u4e5f\u90fd\u4f1a\u5168\u90e8\u4e0d\u53ef\u89c1\u3002\u4e8e\u662f\uff0c\u6211\u4eec\u5c31\u4f1a\u6709\u7c7b\u4f3c\u7684\u8ba4\u8bc6\u8fc1\u79fb\uff1a\u5e94\u7528\u4e86<code>visibility:hidden<\/code>\u58f0\u660e\u4e0b\u7684\u5b50\u5b59\u5143\u7d20\u5982\u4f55\u4e0d\u5c48\u5730\u6323\u624e\u90fd\u6446\u8131\u4e0d\u4e86\u4e0d\u53ef\u89c1\u88ab\u62b9\u6740\u7684\u547d\u8fd0\u3002\u800c\u5b9e\u9645\u4e0a\u5374\u5b58\u5728\u9690\u85cf\u201c\u5931\u6548\u201d\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u4f55\u65f6\u9690\u85cf\u201c\u5931\u6548\u201d\uff1f\u5f88\u7b80\u5355\uff0c\u5982\u679c\u5b50\u5b59\u5143\u7d20\u5e94\u7528\u4e86<code>visibility:visible<\/code>\uff0c\u90a3\u4e48\u8fd9\u4e2a\u5b50\u5b59\u5143\u7d20\u53c8\u4f1a\u5218\u8c26\u822c\u5730\u663e\u73b0\u51fa\u6765\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201202\/css-visibility-break-parent.html\">CSS visibility\u5c5e\u6027\u7684\u682a\u8fde\u6027\u6d4b\u8bd5demo<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201801\/2018-01-02_011650.png\" width=\"359\" height=\"477\" alt=\"visibility\u5c5e\u6027\u7684\u8986\u76d6\u6027\u6d4b\u8bd5\u9875\u9762\u622a\u56fe\u6807\u6ce8\u793a\u610f\" class=\"alignnone\" \/><\/p>\n<p><code>visibility<\/code>\u5c31\u662f\u8fd9\u6837\u4e00\u4e2afunny\u7684\u5c5e\u6027\u3002<\/p>\n<p><strong>\u5bf9\u6bd4\u603b\u7ed3\uff1a<\/strong><br \/>\n<code>display:none<\/code>\u662f\u4e2a\u76f8\u5f53\u60e8\u65e0\u4eba\u9053\u7684\u58f0\u660e\uff0c\u5b50\u5b59\u540e\u4ee3\u5168\u90e8\u641e\u6b7b\uff08\u682a\u8fde\u6027\uff09\uff0c\u800c\u4e14\u8fde\u5757\u5b89\u846c\u7684\u5730\u65b9\u90fd\u4e0d\u7559\uff08\u4e0d\u7559\u7a7a\u95f4\uff09\uff0c\u5bfc\u81f4\u5168\u4f53\u6c11\u4f17\u54d7\u7136\uff08\u6e32\u67d3\u4e0e\u56de\u6d41\uff09\u3002<br \/>\n<code>visibility:hidden<\/code>\u5219\u5177\u6709\u4eba\u9053\u4e3b\u4e49\u5173\u6000\uff0c\u867d\u7136\u4e0d\u5f97\u5df2\u641e\u6b7b\u5b50\u5b59\uff0c\u4f46\u662f\u5b50\u5b59\u53ef\u4ee5\u901a\u8fc7\u4e00\u5b9a\u624b\u6bb5\u907f\u514d\uff08\u4f2a\u682a\u8fde\u6027\uff09\uff0c\u800c\u4e14\u6b7b\u540e\u5168\u5c38\uff0c\u5893\u5730\u4ff1\u5168\uff08\u5360\u636e\u7a7a\u95f4\uff09\uff0c\u56fd\u5185\u6c11\u4f17\u6bd4\u8f83\u6de1\u7136\uff08\u65e0\u6e32\u67d3\u4e0e\u56de\u6d41\uff09\u3002<\/p>\n<p><strong>\u9644\u4e0a<\/strong><br \/>\n\u672c\u8282\u672b\u4e86\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201202\/css-display-none-break-parent.html\">display:none\u682a\u8fde\u6027\u6d4b\u8bd5demo<\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u5230demo\u9875\u9762\u4e2d\u5f20\u7f8e\u5973\u90fd\u8ddf\u9753\u4ed4\u8fc7\u60c5\u4eba\u8282\u53bb\u4e86\u3002<\/p>\n<h3>\u4e09\u3001visibility\u9690\u85cf\u201c\u5931\u6548\u201d\u5999\u7528<\/h3>\n<p>visibility\u9690\u85cf\u201c\u5931\u6548\u201d \u7684\u5e94\u7528\u5176\u5b9e\u5728\u8001\u65e9\u7684\u65f6\u5019\u5c31\u6709\u4e86\uff0c\u7b49\u4e0b\uff0c\u8ba9\u6211\u627e\u627e~~<\/p>\n<p>\u554a\u54c8\uff0c\u627e\u5230\u4e86\u3002<br \/>\n\u53bb\u5e74\u7684\u53bb\u5e745\u6708\u4efd<a target=\"_blank\" href=\"http:\/\/www.xuwanting.com\/study\/201005\/css3-window7-ui.html\">CSS3\u6a21\u62dfwindow7\u70ab\u9177\u754c\u9762\u6548\u679cdemo<\/a>\uff0c\u539f\u6587\u70b9\u51fb<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=810\">\u8fd9\u91cc<\/a>\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"584\" height=\"176\" class=\"alignnone\" title=\"CSS3\u6a21\u62dfwindow7\u70ab\u9177\u754c\u9762\u6548\u679c\u622a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201005\/2010-05-07_193633.png\" alt=\"CSS3\u6a21\u62dfwindow7\u70ab\u9177\u754c\u9762\u6548\u679c\u622a\u56fe \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"177\" class=\"alignnone\" title=\"\u67e5\u770b\u5bf9\u5e94\u6838\u5fc3CSS\u4ee3\u7801 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\" http:\/\/image.zhangxinxu.com\/image\/blog\/201005\/2010-05-07_195840.png\" alt=\"\u67e5\u770b\u5bf9\u5e94\u6838\u5fc3CSS\u4ee3\u7801 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\"><\/p>\n<p>\u590d\u9009\u6846\u52fe\u9009\u4e0e\u5426\u5bf9\u5e94\u7684\u90e8\u5206\u663e\u793a\u4e0e\u9690\u85cf\u3002\u4f8b\u5982\uff0c\u5076\u4eec\u8981\u8ba9\u7236\u6807\u7b7e\u7684\u5706\u89d2\u554a\u3001\u6295\u5f71\u554a\u3001\u80cc\u666f\u554a\u4ec0\u4e48\u7684\u90fd\u9690\u6389\uff0c\u53ea\u7559\u91cc\u9762\u7684\u6587\u672c\u6846\u3002\u8be5\u600e\u4e48\u5b9e\u73b0\uff1f\u5982\u679c\u662f\u8981<code>display:none<\/code>\uff0c\u5219\u91cc\u9762\u7684\u6587\u672c\u6846\u6846\u4e5f\u4f1a\u88ab\u4e00\u5e76\u62b9\u6740\u6389\u7684\uff0c\u5982\u679c\u662f\u8981\u811a\u672c\u63a7\u5236style\uff0c\u54c7\u54e6\u54e6\uff0c\u8fd9\u4e48\u591a\u6837\u5f0f\uff0c\u60f3\u60f3\u8111\u888b\u5c31\u5927\u4e86\u3002\u6bcb\u5eb8\u7f6e\u7591\uff0c\u8fd9\u91cc\u4f7f\u7528<code>visibility<\/code>\u63a7\u5236\u662f\u6700\u9ad8\u6548\u4e5f\u662f\u6700\u5de7\u5999\u7684\u65b9\u6cd5\u3002<\/p>\n<h3>\u56db\u3001height:0\u548coverflow:hidden\u7684\u7ec4\u5408<\/h3>\n<p><code>overflow:hidden<\/code>\u7528\u4e2d\u6587\u7406\u89e3\u5c31\u662f\u201c\u6ea2\u51fa\u9690\u85cf\u201d\uff0c\u4e5f\u5c31\u662f\u76d2\u5b50\u4ee5\u5916\u7684\u5185\u5bb9\u90fd\u5494\u5693\u6389\u4e0d\u53ef\u89c1\u7684\u3002\u52a0\u4e0a<code>height:0<\/code>\uff0c\u53ea\u8981\u662f\u4e00\u822c\u7684\u975einline\u6c34\u5e73\u5143\u7d20\uff0c\u5219\u5143\u7d20\u5185\u90e8\u6240\u6709\u5b50\u5b59\u90fd\u5e94\u8be5\u662f\u4e0d\u53ef\u89c1\u7684\u3002\u8fd9\u662f\u6211\u4eec\u5177\u8c61\u5316\u7684\u8ba4\u8bc6\uff0c\u800c\u4e14N\u591a\u7684\u7ecf\u9a8c\u9a8c\u8bc1\u90fd\u662f\u5982\u6b64\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a\u662f\u8fd9\u6837\u5b50\u5417\uff1f<\/p>\n<p>\u5148\u770b\u4e00\u4e2a\u53cd\u4f8bdemo\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201202\/css-overflow-hidden-break-parent.html\">0\u9ad8\u5ea6\u6ea2\u51fa\u9690\u85cf\u201c\u5931\u6548\u201ddemo<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201801\/2018-01-02_012010.png\" width=\"357\" height=\"498\" alt=\"height:0\u548coverflow:hidden\u5931\u6548\u7684\u4f8b\u5b50\u622a\u56fe\" class=\"alignnone\" \/><\/p>\n<p><code>height:0<\/code>\u548c<code>overflow:hidden<\/code>\u7ec4\u5408\u9690\u85cf\u201c\u5931\u6548\u201d\u7684\u6761\u4ef6\u5982\u4e0b\uff1a\u7956\u5148\u5143\u7d20\u6ca1\u6709<code>position:relative\/absolute\/fixed<\/code>\u58f0\u660e\uff0c\u540c\u65f6\u5185\u90e8\u5b50\u5143\u7d20\u5e94\u7528\u4e86<code>position:absolute\/fixed<\/code>\u58f0\u660e\u3002<\/p>\n<p><strong>\u4e3a\u4ec0\u4e48\u4f1a\u8fd9\u6837\uff1f<\/strong><br \/>\n\u5148\u770b\u4e0bCSS2.1\u89c4\u8303\u4e2d\u5bf9overflow\u7684\u4e00\u70b9\u89e3\u91ca\uff1a<\/p>\n<blockquote><p>This property specifies whether content of a block container element is clipped when it overflows the element&#8217;s box. It affects the clipping of all of the element&#8217;s content except any descendant elements (and their respective content and descendants) whose containing block is the viewport or an ancestor of the element.<\/p><\/blockquote>\n<p>\u4ec0\u4e48\u610f\u601d\u5462\uff1f\u6211\u7422\u78e8\u4e86\u53c8\u7422\u78e8\uff0c\u5509\uff0c\u53ea\u53f9\u7406\u89e3\u4e0d\u591f\u6df1\u5165\uff0c\u4e5f\u6709\u4e9b\u7406\u4e0d\u6e05\u3002\u6211\u60f3\u5927\u81f4\u610f\u601d\u5e94\u8be5\u8fd9\u6837\uff08\u82e5\u6709\u4e0d\u5bf9\u5e94\u8be5\u6307\u6b63\uff09\uff1a<code>overflow<\/code>\u53ef\u4ee5\u526a\u88c1\u8d85\u51fa\u5757\u72b6\u5143\u7d20\u4e4b\u5916\u7684\u5143\u7d20\u3002\u9664\u975e\u8d85\u51fa\u5143\u7d20\u7684\u5305\u542b\u5757\u662f\u6574\u4e2a\u89c6\u533a\u6216\u662f\u8be5overflow\u5143\u7d20\u7684\u7956\u5148\u5143\u7d20\u3002\u7136\u540e\u7edd\u5bf9\u5b9a\u4f4d\u5143\u7d20\u7684\u5305\u542b\u5757\u5e94\u8be5\u5c31\u662f\u542b\u6709<code>position:relative\/absolute\/fixed<\/code>\u7684\u7956\u5148\u5143\u7d20\u3002<\/p>\n<p>\u56e0\u6b64\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>body\n    height: 0; overflow: hidden;\n        position: absolute; <span style=\"color:green;\">\/* \u4e0d\u4f1a\u88ab\u9690\u85cf *\/<\/span><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>position: relative;\n    height: 0; overflow: hidden;\n        position: absolute; <span style=\"color:green;\">\/* \u4e0d\u4f1a\u88ab\u9690\u85cf *\/<\/span><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>height: 0; overflow: hidden;  position: relative;\n    position: absolute; <span style=\"color:green;\">\/* \u4f1a\u88ab\u9690\u85cf *\/<\/span><\/pre>\n<\/div>\n<div class=\"zxx_code\">\n<pre>height: 0; overflow: hidden;\n    position: relative;\n        position: absolute; <span style=\"color:green;\">\/* \u4f1a\u88ab\u9690\u85cf *\/<\/span><\/pre>\n<\/div>\n<p>\u8bb0\u4f4f\u8fd9\u4e2a\uff1a<code>position: absolute<\/code>\u5143\u7d20\u6ea2\u51fa<code>overflow: hidden<\/code>\u5143\u7d20\u7684\u65f6\u5019\uff0c\u5982\u679c\u5176\u7b2c\u4e00\u4e2a\u542b\u6709<code>position<\/code>\u5c5e\u6027(<code>static<\/code>\u9664\u5916)\u7684\u7956\u5148\u5143\u7d20\uff08\u4e00\u76f4\u5230<code>body<\/code>\uff09\u662f<code>overflow: hidden<\/code>\u5143\u7d20\u7956\u5148\u5143\u7d20\u7684\u65f6\u5019\uff0c\u5219\u4e0d\u9690\u85cf\uff1b\u5426\u5219\uff0c\u9690\u85cf\u3002<\/p>\n<p>\u6216\u8005\u8bb0\u4f4f\u8fd9\u4e2a\uff1a\u706b\u661f\u4eba\u5728\u5730\u7403\u89e6\u53d1\u4e86\u6cd5\u5f8b\uff0c\u5982\u679c\u706b\u661f\u4eba\u7684\u8001\u7238\u5728\u8fd9\u6cd5\u5f8b\u4e4b\u5916\uff0c\u5219\u8fd9\u4e2a\u706b\u661f\u4eba\u5565\u4e8b\u6ca1\u6709\uff1b\u5426\u5219\uff0c\u5750\u7262\uff01<\/p>\n<h3>\u4e94\u3001height:0\u548coverflow:hidden\u201c\u5931\u6548\u201d\u5999\u7528<\/h3>\n<p>\u524d\u4e0d\u4e45\u5728<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=2124\">\u201cabsolute\u5143\u7d20\u5728text-align\u5c5e\u6027\u4e0b\u7684\u5bf9\u9f50\u663e\u793a\u201d<\/a>\u4e00\u6587\u4e2d\u4ecb\u7ecd\u4e86\u4e00\u79cd\u7b80\u5355\u4f7f\u7528<code>text-align<\/code>\u5c5e\u6027\u5b9e\u73b0\u201c\u8fd4\u56de\u9876\u90e8\u201d\u6309\u94ae\u5b9a\u4f4d\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201112\/text-align-right-position-fixed-top.html\" target=\"_blank\" class=\"a_link\">text-align:right\u58f0\u660e\u4e0b\u7684\u8fd4\u56de\u9876\u90e8\u5b9a\u4f4ddemo<\/a><\/p>\n<p>\u540e\u6765\u6709\u4eba\u53cd\u6620\uff0c\u6b64\u65b9\u6cd5\u597d\u662f\u597d\uff0c\u4f46\u662f\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u56e0\u4e3a\u6807\u7b7e\u5185\u6253\u4e86\u4e2a<code>&amp;nbsp;<\/code>\u7a7a\u683c\uff0c\u4ea7\u751f\u4e86\u4e86\u7a7a\u767d\u9ad8\u5ea6\u554a\uff01<\/p>\n<p>\u5982\u4f55fix\u8fd9\u91cc\u7684\u7a7a\u683c\u4ea7\u751f\u7684\u9ad8\u5ea6\u5462\uff1f\u4f7f\u7528<code>line-height: 0;<\/code> ? \u6216\u8005\u4f7f\u7528<code>font-size: 0;<\/code>? \u5982\u679c\u4e0d\u662f\u56e0\u4e3a<code>line-height<\/code>\u548c<code>font-size<\/code>\u5177\u6709\u7ee7\u627f\u6027\uff0c\u8fd9\u786e\u5b9e\u662f\u4e2a\u597d\u65b9\u6cd5\uff08font-size\u8fd8\u6709Chrome\u9ed8\u8ba4\u6587\u5b57\u65e0\u6cd5\u5c0f\u4e8e12\u50cf\u7d20\u95ee\u9898\uff0c\u8003\u53e4\u7248\u672cIE\u4e0b0\u50cf\u7d20\u6587\u5b57\u5448\u73b0\u5c0f\u70b9\u7684\u95ee\u9898\uff09\u3002<\/p>\n<p>\u7ecf\u8fc7\u6211\u591a\u65b9\u6d4b\u8bd5\uff0c\u4ee5\u5728OOCSS\u5f00\u53d1\u6a21\u5f0f\u4e0b\uff0c\u8fd9\u91cc\u4f7f\u7528<code>height:0<\/code>\u548c<code>overflow:hidden<\/code>\u662f\u6700\u597d\u7684\u65b9\u6cd5\u3002<\/p>\n<div class=\"zxx_code\">\n<pre>h0 ovh tr\n    <span style=\"color:#333;\">&amp;nbsp;<\/span> abs<\/pre>\n<\/div>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201202\/text-align-right-position-absolute-height-0.html\">text-align\u4e0b\u8fd4\u56de\u9876\u90e8\u4e0d\u5360\u636e\u7a7a\u95f4demo<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\u4f7f\u7528height:0 overflow:hidden\u5b9e\u73b0\u4e0d\u5360\u636e\u7a7a\u95f4 \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201202\/2012-02-14_161258.png\" title=\"\u4f7f\u7528height:0 overflow:hidden\u5b9e\u73b0\u4e0d\u5360\u636e\u7a7a\u95f4\" class=\"alignnone\" width=\"233\" height=\"244\" \/><\/p>\n<p>demo\u4e2d\uff0c\u4e0a\u9762\u4e00\u4e2a\u6761\u6761<code>&amp;nbsp;<\/code>\u4ea7\u751f\u9ad8\u5ea6\uff0c\u56e0\u6b64\u5934\u90e8\u80cc\u666f\u8272\uff0c\u800c\u4e0b\u9762\u8fd9\u4e2a\u6761\u6761\u5c31\u6ca1\u6709\u3002\u56e0\u4e3a\u5b9a\u4f4d\u5143\u7d20\u662f\u7edd\u5bf9\u5b9a\u4f4d\u7684\uff0c\u56e0\u6b64\uff0c\u4e0d\u8981\u62c5\u5fc3\u4f1a\u88ab<code>overflow<\/code>\u4e0d\u5c0f\u5fc3\u5e72\u6389\uff01<\/p>\n<h3>\u516d\u3001\u60c5\u4eba\u8282\u7ed3\u8bed<\/h3>\n<p>\u636e\u8bf4\u4eca\u5929 <a href=\"http:\/\/weibo.com\/n\/%E6%B7%98%E5%AE%9D%E8%B6%85%E4%BB%81\">@\u6dd8\u5b9d\u8d85\u4ec1<\/a> \u82b1\u4e8610W\u5728\u6dd8\u5b9d\u4e0a\u4e70\u4e86\u4e2a\u5e7f\u544a\u4f4d\u5411<a href=\"http:\/\/weibo.com\/n\/%E5%80%A9%E5%B0%8F%E8%8E%B2\"> @\u5029\u5c0f\u83b2<\/a> \u8868\u767d\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\u6dd8\u5b9d\u9996\u9875\u60c5\u4eba\u8282\u8868\u767d \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201202\/2012-02-14_162505.png\" title=\"\u6dd8\u5b9d\u9996\u9875\u60c5\u4eba\u8282\u8868\u767d \u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" class=\"alignnone\" width=\"502\" height=\"179\" \/><\/p>\n<p>\u8fd9\u4f4d\u54e5\u4eec\u771f\u662f\u5927\u624b\u7b14\u554a\uff0c\u6211\u8f88\u5b9e\u5728\u671b\u5c18\u83ab\u53ca\uff0c\u53ea\u80fd\u7528\u6bdb\u4e3b\u5e2d\u6362\u4e9b\u5fb7\u8299\u4e86\u3002\u60f3\u4e86\u60f3\uff0c\u6324\u4e0d\u51fa\u8bbe\u4e48\u8bdd\u4e86\uff0c\u5c31\u8fd9\u6837\u5427\u3002<\/p>\n<p>\u672b\u4e86\uff0c\u518d\u9644\u4e0a\u4e00\u4e2a<code>opacity<\/code>\u900f\u660e\u5ea6\u8986\u76d6\u6027\u6d4b\u8bd5demo\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/201202\/css-opacity-break-parent.html\">opacity\u900f\u660e\u5ea6\u8986\u76d6\u6027\u6d4b\u8bd5demo<\/a><\/p>\n<p>\u7ed3\u679c\u663e\u793a\uff0c\u900f\u660e\u5ea6\u5c5e\u6027\u4f1a\u91cd\u53e0\uff0c\u5177\u6709\u8986\u76d6\u6027\u3002<\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"http:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=2191\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=2191<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728CSS\u4e2d\uff0c\u8ba9\u5143\u7d20\u9690\u85cf\uff08\u6307\u5c4f\u5e55\u8303\u56f4\u5185\u8089\u773c\u4e0d\u53ef\u89c1\uff09\u7684\u65b9\u6cd5\u5f88\u591a\uff0c\u6709\u7684\u5360\u636e\u7a7a\u95f4\uff0c\u6709\u7684\u4e0d\u5360\u636e\u7a7a\u95f4\uff1b\u6709\u7684\u53ef\u4ee5\u54cd\u5e94\u70b9\u51fb\uff0c\u6709\u7684\u4e0d\u80fd\u54cd\u5e94\u70b9\u51fb\u3002\u7136\u800c\uff0c\u5176\u4e2d\u6709\u4e9b\u9690\u85cf\u65b9\u6cd5\u4f1a\u51fa\u73b0\u201c\u5931\u6548\u201d\u7684\u60c5\u51b5\u3002\u800c\u8fd9\u4e9b\u201c\u5931\u6548\u201d\u7684\u60c5\u51b5\u5f80\u5f80\u4f1a\u6709\u4e00\u4e9b\u548c\u5de7\u5999\u7684\u5e94\u7528\u3002\u672c\u6587\u5c31\u662f\u4ecb\u7ecd\u8fd9\u4e9b\u201c\u5931\u6548\u201d\u60c5\u51b5\u5e76\u5217\u4e3e\u4e86\u5176\u4e00\u4e9b\u6bd4\u8f83\u5de7\u5999\u7684\u5e94\u7528\u3002\u4e00\u5982\u65e2\u5f80\uff0cdemo\u9875\u9762\uff0c\u622a\u56fe\uff0c\u5fc5\u8981\u7684\u4ee3\u7801\u5c55\u793a\uff0c\u603b\u4e4b\uff0c\u5e0c\u671b\u672c\u6587\u7684\u5185\u5bb9\u80fd\u591f\u5bf9\u60a8\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\u3002<\/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":[276,583,679,398,69,275,581],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2191"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2191"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/2191\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}