CSS10. 定位 - z-index
描述
z-index属性设置元素的堆叠顺序,拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的上面。z-index可以设置为负数,且该属性只能作用于定位元素。HTML/CSS/JavaScript 解法, 执行用时: 1743ms, 内存消耗: 77772KB, 提交时间: 2022-01-22
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n <style type=\"text/css\">\n * {\n margin: 0;\n padding: 0;\n }\n img{\n position:absolute;left:0px;top:0px;z-index:-1;\n }\n </style>\n </head>\n <body>\n \t<h1>The countdown to Christmas starts here.</h1>\n <img src=\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuploads.xuexila.com%2Fallimg%2F1912%2F1135-191202143454.jpg&refer=http%3A%2F%2Fuploads.xuexila.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639984107&t=eca951193e736a17eb96278117bcfb1f\" width=\"100\">\n <p>由于图像的 z-index 是 -1,因此它在文本的后面出现。</p>\n </body>\n</html>","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1748ms, 内存消耗: 77868KB, 提交时间: 2021-12-30
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n <style type=\"text/css\">\n * {\n margin: 0;\n padding: 0;\n }\n img{\n position: absolute;\n left:0;\n top:0;\n z-index:-1;\n \n }\n </style>\n </head>\n <body>\n \t<h1>The countdown to Christmas starts here.</h1>\n <img src=\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuploads.xuexila.com%2Fallimg%2F1912%2F1135-191202143454.jpg&refer=http%3A%2F%2Fuploads.xuexila.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639984107&t=eca951193e736a17eb96278117bcfb1f\" width=\"100px\">\n <p>由于图像的 z-index 是 -1,因此它在文本的后面出现。</p>\n </body>\n</html>","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1750ms, 内存消耗: 77772KB, 提交时间: 2021-12-21
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n <style type=\"text/css\">\n * {\n margin: 0;\n padding: 0;\n }\n img{\n position: absolute;\n left:0px;\n top:0px;\n z-index:-1;\n }\n </style>\n </head>\n <body>\n \t<h1>The countdown to Christmas starts here.</h1>\n <img src=\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuploads.xuexila.com%2Fallimg%2F1912%2F1135-191202143454.jpg&refer=http%3A%2F%2Fuploads.xuexila.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639984107&t=eca951193e736a17eb96278117bcfb1f\" width=\"100\">\n <p>由于图像的 z-index 是 -1,因此它在文本的后面出现。</p>\n </body>\n</html>","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1750ms, 内存消耗: 77884KB, 提交时间: 2021-12-23
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n <style type=\"text/css\">\n * {\n margin: 0;\n padding: 0;\n }\n img {\n position:absolute;\n left:0px;\n top:0px;\n z-index:-1;\n }\n </style>\n </head>\n <body>\n \t<h1>The countdown to Christmas starts here.</h1>\n <img src=\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuploads.xuexila.com%2Fallimg%2F1912%2F1135-191202143454.jpg&refer=http%3A%2F%2Fuploads.xuexila.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639984107&t=eca951193e736a17eb96278117bcfb1f\" width=\"100\">\n <p>由于图像的 z-index 是 -1,因此它在文本的后面出现。</p>\n </body>\n</html>","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1751ms, 内存消耗: 77880KB, 提交时间: 2022-01-24
{"css":"","js":"","html":"<!DOCTYPE html>\n<html>\n <head>\n <meta charset=utf-8>\n <style type=\"text/css\">\n * {\n margin: 0;\n padding: 0;\n }\n img {\n position: absolute;\n left: 0px;\n top: 0px;\n z-index: -1;\n }\n </style>\n </head>\n <body>\n \t<h1>The countdown to Christmas starts here.</h1>\n <img src=\"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fuploads.xuexila.com%2Fallimg%2F1912%2F1135-191202143454.jpg&refer=http%3A%2F%2Fuploads.xuexila.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1639984107&t=eca951193e736a17eb96278117bcfb1f\" width=\"100\">\n <p>由于图像的 z-index 是 -1,因此它在文本的后面出现。</p>\n </body>\n</html>","libs":[]}