html - 如何在html中将一张卡放置得比它的邻居高一点

标签 html css

我试图将一张卡片放置在其相邻列上方一点的位置。这是这些卡片放置的图像:

enter image description here

这是我的 html:

<div class="row">

                    <div class="col span-1-of-2 service-cards card-set">

                        <div class="card first-card">
                            <div class="container">
                                <img src="resources/img/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3c4e594f485d494e5d52481150555b54487c0e44124c525b" rel="noreferrer noopener nofollow">[email protected]</a>" class="icon-small">
                                <h4><b>UI/UX & mobile <br>application</b></h4> 
                                <p class="subtitle-paragraph service-para-1">We are the finest digital solution providers in town with high quality service.</p> 
                            </div>
                        </div>

                        <div class="card">
                            <div class="container">
                                <img src="resources/img/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cfbdaabcbbaebabdaea1bbe2a3a6a8a7bb8ffdb7e1bfa1a8" rel="noreferrer noopener nofollow">[email protected]</a>" class="icon-small">
                                <h4><b>Branding & <br>Corporate identity</b></h4> 
                                <p class="subtitle-paragraph service-para">We are the finest digital solution providers in town with high quality service.</p> 
                            </div>
                        </div>

                    </div>

                </div>

最佳答案

您可以使用相对位置将一张卡放置在略低于另一张卡的位置

.container {
  display: flex;
  justify-content: center;
}

.card {
  height: 170px;
  width: 100px;
  border: 1px solid;
  position: relative;
  margin: 0 5px;
}

.first-card {
  top: 10px;
}
<div class="container">
    <div class="card first-card"></div>
    <div class="card"></div>
</div>

关于html - 如何在html中将一张卡放置得比它的邻居高一点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58716307/

相关文章:

javascript - 如何在html表格中创建多维数组

css - Bootstrap 中不同页面的不同背景图片

html - nth-child 具有不同宽度的 CSS 网格布局

html - 使用 css 动画更改悬停时的圆圈背景

javascript - 文本输入边框颜色在焦点上未正确更改

css - 无法突出显示当前菜单项/页面 wordpress

css - 如何给图片添加文字装饰?

javascript - 使用 jquery 更改链接样式和属性

javascript - 如果我在父页面中加载后将其 src 更改为 "about:blank",iframe 能否访问其父页面?

javascript - Ionic 2 ionic 搜索栏图标