如何使用HTML和CSS制作这张卡片?[关闭]

qkf9rpyu  于 5个月前  发布在  其他
关注(0)|答案(3)|浏览(61)

**已关闭。**此问题需要debugging details。目前不接受回答。

编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答问题。
8天前关闭。
Improve this question
solo linktree example picture
这是solo.to链接树中的一个例子。我想问一下如何用html和css来展示它。
我原本打算用

float:left;

字符串
让图像浮动,这样文字的边框就可以切穿图像,但最后我发现图像只会被边框挤出来,我也试着找过有没有类似的样子,但找不到

lokaqttq

lokaqttq1#

我找到解决你问题的方法了。请检查代码。
将此代码添加到您的HTML和CSS文件。不要忘记运行代码嗅探器在整个页面。

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap'); 
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
  }

body{
    display: flex;
    background: rgb(235, 235, 235);
    margin: 150px;
    
    
  }
  
  .card{
    position: absolute;
    width: 400px;
    height: 200px;
    background: #eaf5f0;
    border-radius: 5px;
    box-shadow: 0 35px 80px rgba(0,0,0,0.15);
    transition: 0.5s;
    margin: 50px;
    flex-wrap: wrap;
  }

  .imgBx img{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
  }

  .imgBx{
    position: absolute;
    top: 25px;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(112, 112, 112, 0.35);
    transition: 0.5s;
  }

  
.card .content{
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  
  .card .content .details{
    margin-left: 20px;
    text-align: left;
  }

  #arrow{
    background-color: #eaf5f0;
    position: absolute;
    transform: translateX(160px);
    width: 25px;
    height: 25px;
    border-radius: 5px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.35);
    
  }

个字符

qco9c6ql

qco9c6ql2#

您可以使用position: relative创建重叠效果,并通过调整top、bottom、left或right属性来微调图像放置。
演示Stackblitz

xeufq47z

xeufq47z3#

我的尝试(用不同的字体和箭头)

  • 纯HTML/CSS
  • 零图像
div#main {
  position:relative;
  margin-left:calc(50% - 200px);
  margin-top:50px;
}
div#main div#orange-box {
  position: absolute;
  width: 80px;
  height: 80px;
  left: -40px;
  background-color: color(srgb 0.9694 0.4055 0.3275);
  box-shadow: 0px 5px 20px 5px color(srgb 0.9694 0.4055 0.3275 / 0.20);
  z-index: 3;
 }
 
 div#main div#orange-box div#rect {
  position:absolute;
  background-color:white;
  width: 8px;
  height: 40px;
  top: calc(50% - 20px);
  left:30%;
 }
  div#main div#orange-box div#circle {
  position:absolute;
  background-color:white;
  width: 35%;
  height: 35%;
  top: calc(50% - 20px);
  left:45%;
  border-radius: 50%;
 }
 
 
 div#main div#text-container {
  position: absolute;
  border:1.5px solid #EEEEEE;
  border-radius: 2px;
  box-shadow: 0px 5px 20px 5px #EEEEEE;
  width: 400px;
  height: 120px;
  top: -20px;
  z-index: 1;
 }
 
 div#main div#text-container span#arrow {
  position:absolute;
  right: 20px;
  top: calc(50% - 14px);
  color: #CCCCCC;
  font-family: Helvetica;
  font-size: 28px;
 }
 
 div#main div#text-container span#subscribe {
  position: absolute;
  left: 60px;
  top: calc(25%);
  font-family: Avenir Next, Serif;
  font-size: 24px;
  color: #565656;
 }
 
  div#main div#text-container span#patreon {
  position: absolute;
  left: 60px;
  top: calc(50%);
  font-family: Avenir Next, Serif;
  font-size: 20px;
  color: #CCCCCC;
 }

个字符

相关问题