Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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
在css和html中,如何将一个图像的阴影投射到它下面的另一个图像上?_Html_Image_Css - Fatal编程技术网

在css和html中,如何将一个图像的阴影投射到它下面的另一个图像上?

在css和html中,如何将一个图像的阴影投射到它下面的另一个图像上?,html,image,css,Html,Image,Css,如何将阴影添加到pic1到pic2。有什么方法可以使阴影彼此相似吗?阴影不会与同一z级别上的元素重叠。使用位置:相对或绝对,并使用z索引更改元素的级别 把前面的那个放高一些,比如: <html> <head> <link rel="stylesheet" href="layout.css" type="text/css" /> </head> <body> <h1>L

如何将阴影添加到pic1到pic2。有什么方法可以使阴影彼此相似吗?

阴影不会与同一z级别上的元素重叠。使用位置:相对或绝对,并使用z索引更改元素的级别

把前面的那个放高一些,比如:

<html>
  <head>       
    <link rel="stylesheet" href="layout.css" type="text/css" />
  </head>        
  <body>
    <h1>LOGO</h1>
    <div id="linker">
      <a href="http://www.facebook.com"><img src="img1.png"></a>
      <a href="http://twitter.com"><img src="tw.png"></a>        
    </div>
  </body>
</html>

#linker a:first-child {
  position: relative;
  z-index: 10;
  box-shadow: 0 0 10px #000;
}

有趣的是,您问了一个只显示HTML的问题,询问CSS,并希望我们知道您的HTML实际上与页面上的HTML是什么样子的。我们需要拿出水晶球来回答:
#linker a:first-child
{

Position: relative;
Z-index: 2;
-webkit-box-shadow: 0 0 10px gray;
box-shadow: 0 0 10px gray;
}

/* for the second item- twitter*/
#linker a:nth-child(2)
{

Position: relative;
Z-index: 1; /* underneath facebook*/
-webkit-box-shadow: 0 0 10px gray; /* if you want a shadow from twitter*/
box-shadow: 0 0 10px gray;
} >'