如何在卡片中定位重复的径向渐变?

How to position a repeating radial gradient within a card?

提问人:jelliedbro 提问时间:11/15/2023 最后编辑:isherwoodjelliedbro 更新时间:11/17/2023 访问量:46

问:

我在一个网站上有一个个人资料,允许您在设置中输入 HTMl 和 CSS 来自定义您的页面。我的目标是让重复径向渐变的中心从.card中的圆形图片后面开始,这样环就会在它周围形成。

我的问题是,当我添加任何类型的定位(如“在顶部”)时,渐变会完全消失。

我尝试将 CSS 直接放在 HTML 中,看看它是否是卡的 id 弄乱了它,但我得到了相同的结果。

当我将相同的代码放入 jsfiddle 并添加定位时,它出于某种原因起作用。

background: repeating-radial-gradient(circle,#000, #000 20px, #fff 20px, #fff 40px)

结果:

enter image description here

background: repeating-radial-gradient(circle at top,#000, #000 20px, #fff 20px, #fff 40px)

结果:

enter image description here

我的个人资料

#card1 {
  padding-left: 20px;
  padding-right: inherit;
}

#card1 .card {
  border: none;
  background: repeating-radial-gradient(circle, #000, #000 20px, #fff 20px, #fff 40px)
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

<div class="container-fluid d-block card border-0 px-0 py-5" style="margin-top: -58px; background-color: transparent">
  <div class="container text-center px-0" style="letter-spacing: .25px; font-size: 10pt;">
    <div class="row">
      <div class="col-md-4 order-md-2 mb-md-0 mb-3" id="card1">
        <!--------- SIDE STATS -------------------------------------------------------->
        <div class="card d-block modal-open h-100">
          <div class="card-header" style="background-color:black">
            <!-------------- CHARACTER NAME ----------------------------------------->
            <h1 class="text-center text-uppercase mb-0" style="font-weight:300; letter-spacing:1px;">
              Name</h1>
          </div>
          <div class="card-block">
            <!---------------- FOCAL IMAGE -- WILL SCALE ACROSS SCREEN SIZES ---------->
            <img class="image mb-3" src="https://f2.toyhou.se/file/f2-toyhou-se/thumbnails/47592316_Upv.png" style=";background-size:contain;background-position:center;background-repeat:no-repeat;width:150px;border-radius:100%;aspect-ratio:1;">
            </img><br>

            <p style="margin:0px 0px 10px;word-wrap:break-word;">
              <p style="font-family:Grandstander">
                testteste tdis udfufjifjieof jiosjf ijsdpojoisdp jsopd jodisdjos gjiofdsjgosdfgjio djfewiaof fewjfiwoefqwieofjoi fejiwfjweifje fewjfiewjfowe
              </p>

              <hr class="my-2 faded">

              <div class="justify-content-between">
                <span class="text-uppercase text-muted" style="font-weight: 300; letter-spacing: .5px;">
                  Gender</span>
                <span>Content</span>
              </div>
              <hr class="my-2 faded">

              <div class="justify-content-between">
                <span class="text-uppercase text-muted" style="font-weight: 300; letter-spacing: .5px;">
                  Age</span>
                <span>Content</span>
              </div>
              <hr class="my-2 faded">

              <div class="justify-content-between">
                <span class="text-uppercase text-muted" style="font-weight: 300; letter-spacing: .5px;">
                  Role</span>
                <span>(what they do)</span>
              </div>
              <hr class="my-2 faded">

              <div class="justify-content-between">
                <span class="text-uppercase text-muted" style="font-weight: 300; letter-spacing: .5px;">HTML</span>
                <!-- CODING CREDIT -- LEAVE THIS -------------->
                <span>@Pinky</span>
              </div>
              <hr class="my-2 faded">

              <div class="row no-gutters align-items-center">
                <div class="col-auto text-uppercase text-muted" style="font-weight: 300; letter-spacing: .5px;">Theme
                </div>
                <div class="col px-2"></div>
                <div class="col-auto text-primary">
                  Song Name <i class="fas fa-play fa-fw"></i>

                  <!--- INSTRUCTIONS: fill in the "ID_HERE" with a youtube video id, --------->
                  <iframe src="https://www.youtube.com/embed/ID_HERE?modestbranding=1" style="position:absolute; top: 0; bottom:0; left:0; right:0; opacity: .001" class="h-100 w-100" frameborder="0"></iframe>
                </div>
              </div>

HTML CSS Bootstrap-4 径向渐变

评论

0赞 isherwood 11/17/2023
Pastebin 不是在 SO 上共享代码的有效方式,而且您的链接无论如何都不起作用。请参阅“如何提问”并观看导览,然后更新上面的演示以显示问题。
0赞 isherwood 11/17/2023
提示:你真的想停止在标记中放置所有这些内联样式。它使工作和解释您的文档变得更加困难,并且您有大量的重复。使用自定义类和 CSS。

答: 暂无答案