{"id":774,"date":"2025-12-14T14:27:58","date_gmt":"2025-12-14T06:27:58","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=774"},"modified":"2025-12-14T14:27:58","modified_gmt":"2025-12-14T06:27:58","slug":"html5-%e5%ae%9a%e4%bd%8d%e5%a4%a7%e5%85%a8%e4%b9%8b%e7%9b%b8%e5%af%b9%e5%ae%9a%e4%bd%8d%e3%80%81%e7%bb%9d%e5%af%b9%e5%ae%9a%e4%bd%8d%e5%92%8c%e5%9b%ba%e5%ae%9a%e5%ae%9a%e4%bd%8d-2","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/12\/14\/html5-%e5%ae%9a%e4%bd%8d%e5%a4%a7%e5%85%a8%e4%b9%8b%e7%9b%b8%e5%af%b9%e5%ae%9a%e4%bd%8d%e3%80%81%e7%bb%9d%e5%af%b9%e5%ae%9a%e4%bd%8d%e5%92%8c%e5%9b%ba%e5%ae%9a%e5%ae%9a%e4%bd%8d-2\/","title":{"rendered":"HTML5 \u5b9a\u4f4d\u5927\u5168\u4e4b\u76f8\u5bf9\u5b9a\u4f4d\u3001\u7edd\u5bf9\u5b9a\u4f4d\u548c\u56fa\u5b9a\u5b9a\u4f4d"},"content":{"rendered":"\n<p>\u4e0b\u9762\u662f\u4e00\u7bc7<strong>\u53ef\u76f4\u63a5\u53d1\u5e03\u7684\u5b8c\u6574\u6559\u7a0b\u6587\u7ae0<\/strong>\uff0c\u4e3b\u9898\u4e3a\u4f60\u7ed9\u51fa\u7684\u6807\u9898\uff0c\u7ed3\u6784\u6e05\u6670\u3001\u793a\u4f8b\u660e\u786e\uff0c\u9002\u5408\u535a\u5ba2 \/ \u6280\u672f\u7ad9 \/ \u6559\u7a0b\u7c7b\u5185\u5bb9\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">HTML5 \u5b9a\u4f4d\u5927\u5168\uff1a\u76f8\u5bf9\u5b9a\u4f4d\u3001\u7edd\u5bf9\u5b9a\u4f4d\u548c\u56fa\u5b9a\u5b9a\u4f4d<\/h1>\n\n\n\n<p>\u5728 HTML5 \u4e0e CSS \u5e03\u5c40\u4e2d\uff0c<strong>\u5b9a\u4f4d\uff08position\uff09<\/strong> \u662f\u975e\u5e38\u6838\u5fc3\u7684\u6982\u5ff5\u3002\u5408\u7406\u4f7f\u7528\u5b9a\u4f4d\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5143\u7d20\u7cbe\u786e\u5e03\u5c40\u3001\u60ac\u6d6e\u6548\u679c\u3001\u56fa\u5b9a\u5bfc\u822a\u680f\u7b49\u5e38\u89c1\u9700\u6c42\u3002\u672c\u6587\u5c06\u7cfb\u7edf\u8bb2\u89e3 <strong>\u76f8\u5bf9\u5b9a\u4f4d\uff08relative\uff09<\/strong>\u3001<strong>\u7edd\u5bf9\u5b9a\u4f4d\uff08absolute\uff09<\/strong> \u548c <strong>\u56fa\u5b9a\u5b9a\u4f4d\uff08fixed\uff09<\/strong> \u7684\u539f\u7406\u3001\u7528\u6cd5\u4e0e\u533a\u522b\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u3001CSS \u5b9a\u4f4d\u57fa\u7840\u6982\u5ff5<\/h2>\n\n\n\n<p>\u5728 CSS \u4e2d\uff0c\u5b9a\u4f4d\u901a\u8fc7 <code>position<\/code> \u5c5e\u6027\u5b9e\u73b0\uff0c\u5e38\u89c1\u53d6\u503c\u5305\u62ec\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nposition: static | relative | absolute | fixed | sticky;\n\n<\/pre><\/div>\n\n\n<p>\u5176\u4e2d\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>static<\/code>\uff1a\u9ed8\u8ba4\u5b9a\u4f4d\u65b9\u5f0f\uff08\u4e0d\u5b9a\u4f4d\uff09<\/li>\n\n\n\n<li><code>relative<\/code>\uff1a\u76f8\u5bf9\u5b9a\u4f4d<\/li>\n\n\n\n<li><code>absolute<\/code>\uff1a\u7edd\u5bf9\u5b9a\u4f4d<\/li>\n\n\n\n<li><code>fixed<\/code>\uff1a\u56fa\u5b9a\u5b9a\u4f4d<\/li>\n\n\n\n<li><code>sticky<\/code>\uff1a\u7c98\u6027\u5b9a\u4f4d\uff08\u672c\u6587\u4e0d\u91cd\u70b9\u5c55\u5f00\uff09<\/li>\n<\/ul>\n\n\n\n<p>\u672c\u6587\u91cd\u70b9\u8bb2\u89e3\u524d\u4e09\u79cd\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001\u76f8\u5bf9\u5b9a\u4f4d\uff08position: relative\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u5b9a\u4e49\u4e0e\u7279\u70b9<\/h3>\n\n\n\n<p><strong>\u76f8\u5bf9\u5b9a\u4f4d<\/strong> \u662f\u76f8\u5bf9\u4e8e\u5143\u7d20<strong>\u81ea\u8eab\u539f\u6765\u7684\u4f4d\u7f6e<\/strong>\u8fdb\u884c\u504f\u79fb\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.element {\n  position: relative;\n  top: 10px;\n  left: 20px;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. \u6838\u5fc3\u7279\u6027<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5143\u7d20\u4ecd\u7136\u5360\u636e\u539f\u6765\u7684\u6587\u6863\u6d41\u4f4d\u7f6e<\/li>\n\n\n\n<li>\u504f\u79fb\u540e\uff0c<strong>\u539f\u4f4d\u7f6e\u4e0d\u4f1a\u88ab\u5176\u4ed6\u5143\u7d20\u5360\u7528<\/strong><\/li>\n\n\n\n<li>\u5e38\u7528\u4e8e\u4f5c\u4e3a\u7edd\u5bf9\u5b9a\u4f4d\u5143\u7d20\u7684\u201c\u53c2\u8003\u5bb9\u5668\u201d<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5fae\u8c03\u5143\u7d20\u4f4d\u7f6e<\/li>\n\n\n\n<li>\u4f5c\u4e3a <code>absolute<\/code> \u5b50\u5143\u7d20\u7684\u5b9a\u4f4d\u57fa\u51c6<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;box&quot;&gt;\n  &amp;lt;span class=&quot;badge&quot;&gt;NEW&amp;lt;\/span&gt;\n&amp;lt;\/div&gt;\n\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.box {\n  position: relative;\n}\n\n.badge {\n  position: absolute;\n  top: 0;\n  right: 0;\n}\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001\u7edd\u5bf9\u5b9a\u4f4d\uff08position: absolute\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u5b9a\u4e49\u4e0e\u7279\u70b9<\/h3>\n\n\n\n<p><strong>\u7edd\u5bf9\u5b9a\u4f4d<\/strong> \u662f\u76f8\u5bf9\u4e8e<strong>\u6700\u8fd1\u7684\u5df2\u5b9a\u4f4d\u7956\u5148\u5143\u7d20<\/strong>\uff08\u975e static\uff09\u8fdb\u884c\u5b9a\u4f4d\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.element {\n  position: absolute;\n  top: 50px;\n  right: 20px;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. \u5b9a\u4f4d\u89c4\u5219\uff08\u975e\u5e38\u91cd\u8981\uff09<\/h3>\n\n\n\n<p>\u7edd\u5bf9\u5b9a\u4f4d\u5143\u7d20\u7684\u53c2\u8003\u57fa\u51c6\u987a\u5e8f\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6700\u8fd1\u7684 <code>position: relative \/ absolute \/ fixed<\/code> \u7684\u7956\u5148\u5143\u7d20<\/li>\n\n\n\n<li>\u5982\u679c\u6ca1\u6709\uff0c\u5219\u76f8\u5bf9\u4e8e <code>body<\/code>\uff08\u6216\u89c6\u53e3\uff09<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u6838\u5fc3\u7279\u6027<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8131\u79bb\u6587\u6863\u6d41<\/strong><\/li>\n\n\n\n<li>\u4e0d\u518d\u5360\u636e\u539f\u6765\u7684\u7a7a\u95f4<\/li>\n\n\n\n<li>\u53ef\u4ee5\u7cbe\u786e\u63a7\u5236\u4f4d\u7f6e<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5f39\u7a97\u3001\u4e0b\u62c9\u83dc\u5355<\/li>\n\n\n\n<li>\u63d0\u793a\u6846\uff08tooltip\uff09<\/li>\n\n\n\n<li>\u89d2\u6807\u3001\u6d6e\u5c42\u5143\u7d20<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.modal {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n}\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u56db\u3001\u56fa\u5b9a\u5b9a\u4f4d\uff08position: fixed\uff09<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u5b9a\u4e49\u4e0e\u7279\u70b9<\/h3>\n\n\n\n<p><strong>\u56fa\u5b9a\u5b9a\u4f4d<\/strong> \u662f\u76f8\u5bf9\u4e8e**\u6d4f\u89c8\u5668\u89c6\u53e3\uff08viewport\uff09**\u8fdb\u884c\u5b9a\u4f4d\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.element {\n  position: fixed;\n  bottom: 20px;\n  right: 20px;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. \u6838\u5fc3\u7279\u6027<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b8c\u5168\u8131\u79bb\u6587\u6863\u6d41<\/li>\n\n\n\n<li><strong>\u9875\u9762\u6eda\u52a8\u65f6\u4f4d\u7f6e\u4e0d\u53d8<\/strong><\/li>\n\n\n\n<li>\u59cb\u7ec8\u56fa\u5b9a\u5728\u5c4f\u5e55\u6307\u5b9a\u4f4d\u7f6e<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5e38\u89c1\u4f7f\u7528\u573a\u666f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u56fa\u5b9a\u5bfc\u822a\u680f<\/li>\n\n\n\n<li>\u8fd4\u56de\u9876\u90e8\u6309\u94ae<\/li>\n\n\n\n<li>\u60ac\u6d6e\u5ba2\u670d\u6309\u94ae<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.navbar {\n  position: fixed;\n  top: 0;\n  width: 100%;\n}\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e94\u3001\u4e09\u79cd\u5b9a\u4f4d\u65b9\u5f0f\u5bf9\u6bd4<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7279\u6027<\/th><th>\u76f8\u5bf9\u5b9a\u4f4d<\/th><th>\u7edd\u5bf9\u5b9a\u4f4d<\/th><th>\u56fa\u5b9a\u5b9a\u4f4d<\/th><\/tr><\/thead><tbody><tr><td>\u662f\u5426\u8131\u79bb\u6587\u6863\u6d41<\/td><td>\u5426<\/td><td>\u662f<\/td><td>\u662f<\/td><\/tr><tr><td>\u53c2\u8003\u57fa\u51c6<\/td><td>\u81ea\u8eab\u539f\u4f4d\u7f6e<\/td><td>\u6700\u8fd1\u5b9a\u4f4d\u7956\u5148<\/td><td>\u6d4f\u89c8\u5668\u89c6\u53e3<\/td><\/tr><tr><td>\u662f\u5426\u968f\u6eda\u52a8\u79fb\u52a8<\/td><td>\u662f<\/td><td>\u662f<\/td><td>\u5426<\/td><\/tr><tr><td>\u5e38\u89c1\u7528\u9014<\/td><td>\u5fae\u8c03\u3001\u5b9a\u4f4d\u5bb9\u5668<\/td><td>\u5f39\u5c42\u3001\u6d6e\u52a8\u5143\u7d20<\/td><td>\u56fa\u5b9a\u5bfc\u822a\u3001\u60ac\u6d6e\u6309\u94ae<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u516d\u3001\u5e38\u89c1\u9519\u8bef\u4e0e\u6ce8\u610f\u4e8b\u9879<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. absolute \u4e0d\u751f\u6548\uff1f<\/h3>\n\n\n\n<p>\ud83d\udc49 \u901a\u5e38\u662f\u56e0\u4e3a<strong>\u7236\u5143\u7d20\u6ca1\u6709\u8bbe\u7f6e position<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.parent {\n  position: relative;\n}\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. fixed \u5728\u79fb\u52a8\u7aef\u5f02\u5e38\uff1f<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u67d0\u4e9b\u79fb\u52a8\u6d4f\u89c8\u5668\u5bf9 <code>fixed<\/code> \u652f\u6301\u4e0d\u5b8c\u5168<\/li>\n\n\n\n<li>\u53ef\u914d\u5408 <code>meta viewport<\/code> \u6216\u4f7f\u7528 <code>sticky<\/code> \u4f5c\u4e3a\u66ff\u4ee3<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5b9a\u4f4d + z-index<\/h3>\n\n\n\n<p>\u5b9a\u4f4d\u5143\u7d20\u5e38\u4e0e <code>z-index<\/code> \u4e00\u8d77\u4f7f\u7528\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.element {\n  position: absolute;\n  z-index: 999;\n}\n\n<\/pre><\/div>\n\n\n<p>\u26a0\ufe0f <code>z-index<\/code> \u53ea\u5bf9<strong>\u5df2\u5b9a\u4f4d\u5143\u7d20<\/strong>\u751f\u6548\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e03\u3001\u603b\u7ed3<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>relative<\/strong>\uff1a\u4e0d\u8131\u79bb\u6587\u6863\u6d41\uff0c\u7528\u4e8e\u5fae\u8c03\u4e0e\u5b9a\u4f4d\u57fa\u51c6<\/li>\n\n\n\n<li><strong>absolute<\/strong>\uff1a\u8131\u79bb\u6587\u6863\u6d41\uff0c\u7528\u4e8e\u7cbe\u786e\u5e03\u5c40<\/li>\n\n\n\n<li><strong>fixed<\/strong>\uff1a\u56fa\u5b9a\u5728\u89c6\u53e3\uff0c\u7528\u4e8e\u60ac\u6d6e\u4e0e\u5e38\u9a7b UI<\/li>\n<\/ul>\n\n\n\n<p>\u638c\u63e1\u8fd9\u4e09\u79cd\u5b9a\u4f4d\u65b9\u5f0f\uff0c\u662f\u7406\u89e3 CSS \u5e03\u5c40\u4e0e\u9875\u9762\u7ed3\u6784\u7684\u5173\u952e\u4e00\u6b65\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u662f\u4e00\u7bc7\u53ef\u76f4\u63a5\u53d1\u5e03\u7684\u5b8c\u6574\u6559\u7a0b\u6587\u7ae0\uff0c\u4e3b\u9898\u4e3a\u4f60\u7ed9\u51fa\u7684\u6807\u9898\uff0c\u7ed3\u6784\u6e05\u6670\u3001\u793a\u4f8b\u660e\u786e\uff0c\u9002\u5408&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/12\/14\/html5-%e5%ae%9a%e4%bd%8d%e5%a4%a7%e5%85%a8%e4%b9%8b%e7%9b%b8%e5%af%b9%e5%ae%9a%e4%bd%8d%e3%80%81%e7%bb%9d%e5%af%b9%e5%ae%9a%e4%bd%8d%e5%92%8c%e5%9b%ba%e5%ae%9a%e5%ae%9a%e4%bd%8d-2\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-774","post","type-post","status-publish","format-standard","hentry","category-html-xhtml"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/774\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}