gpt4 book ai didi

html - 由于根边距,图形元素上的框阴影变得倾斜

转载 作者:行者123 更新时间:2023-11-28 10:43:34 25 4
gpt4 key购买 nike

我在 figure 元素上提供了一个 box-shadow。但是,由于我提供的 *{margin:10px},图像出现了倾斜。有什么方法可以让我仍然保持这个边距并能够将框阴影放在 figure 元素上吗?

HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link
rel="stylesheet"
href="drop.css"
>

</head>
<body>

<section id="pics">
<figure
id="pic1"
class="pictures"
>
<img
alt="figure1"
src="http://b-i.forbesimg.com/kellyclay/files/2013/12/glass.jpg"
title="pic1"
>
<figcaption class="figuredetails">Fig1</figcaption>

</figure>


<figure
id="pic2"
class="pictures"
>
<img
alt="figure2"
src="http://glass-apps.org/wp-content/uploads/2013/06/google-glass1.jpg"
title="pic2"
>
<figcaption class="figuredetails">Fig2</figcaption>

</figure>
</section>
<section id="content">
<p>hello</p>
</section>
</body>


</html>

CSS:

@CHARSET "UTF-8";
*{
margin: 10px;
/* padding: 10px; */

}


#pics{

width:100%;
padding: 50px 50px;
}

.pictures{
float: left;
width:200px;
height:200px;
box-shadow: 10px 10px 5px #888888;
}

.pictures:before{
border:5px solid black;
}
.pictures:after{
border:5px solid black;
}


.pictures img{
width:100%;
height:auto;
border: 2px solid;

border-color: #ff0000;



}

/* #pic1{

-ms-transform: rotate(30deg); IE 9
-webkit-transform: rotate(30deg); Chrome, Safari, Opera
transform: rotate(30deg);
} */


#pic2{
padding-left: 50px;
}

#content{
clear: both;
}

.pictures > .figuredetails{
color: red;
padding-left: 20px;
}

JSfiddle 在这里:

http://jsfiddle.net/5kgh8/

最佳答案

正如您的第一条评论所说,您希望图片显示在阴影框内,因此您唯一需要做的就是删除

#pic2{
padding-left: 50px;
}

我也没有发现任何用途

*{
margin: 10px;
/* padding: 10px; */
}

也将其删除。

结果:JsFiddle

关于html - 由于根边距,图形元素上的框阴影变得倾斜,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23066771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com