Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使这张图片在html和css屏幕上显示?_Html_Css - Fatal编程技术网

如何使这张图片在html和css屏幕上显示?

如何使这张图片在html和css屏幕上显示?,html,css,Html,Css,我想让一个html文件顶部的图像在整个屏幕上都没有间隙,我怎么能做到这一点 <!DOCTYPE html> <html> <head> <title>Coding site!</title> <link rel="stylesheet" type="text/css" href="style.css"> <script src=&qu

我想让一个html文件顶部的图像在整个屏幕上都没有间隙,我怎么能做到这一点

<!DOCTYPE html>
<html>
<head>
    <title>Coding site!</title>
    <link rel="stylesheet" type="text/css" href="style.css">
     <script src="myscripts.js"></script> 
</head>
<body>
    <img src="coding.jpg" style="width:42px;height:42px;">
</body>
</html> 

编码站点!
之所以存在“间隙”,是因为在大多数主流浏览器中,
主体
元素的默认边距在所有边上都是8px。要删除它,请添加以下CSS样式:

正文{
保证金:0;
填充:0;
}

编码站点!

将其宽度设置为100%,边距设置为0px。

为使图像适合框架,将宽度设置为100%,并将主体填充设置为0;利润率:0;在内部CSS文件中