skip to Main Content

How might something like this be coded using HTML & CSS? Primarily the icon situated next to some text with border wrapping the text/copy. Initial approach is using an SVG but I can’t seem to make it work. Is this even possible? Perhaps the only way would be to use non-transparent graphics and overlay them on top of a div with the text that has the radius border applied through CSS?

This is already being used in production to some extent. You can see these blockquotes appear on page in a couple of places.

This is what I have:

.gray_box_conten {
  background-color: #e7e4f0;
  max-width: 890px;
  margin: 50px auto 0;
  padding: 30px 50px;
  align-items: center;
}

.gray_box_conten,
.white_box {
  min-height: 162px;
  border-radius: 28px;
  display: flex;
}

.man-QA {
  max-width: 120px;
  min-width: 120px;
  padding-right: 25px;
}

.risk_adjustment .content_wrap1,
img {
  max-width: 100%;
}

.Quality__frequently,
.error-page .container,
.map_grid img,
.menuLink ul li.current-menu-parent a::after,
.news_box_btn .btn_cta {
  width: 100%;
}

.Quality__frequently p {
  color: #22003f;
  font-size: 20px;
  font-weight: 700;
}
<div class="gray_box_conten">
  <div class="man-QA">
    <img src="https://innovista-health.com/wp-content/uploads/2023/10/qa-info-blurb-icon.svg" alt="" title="qa-info-blurb-icon"> </div>
  <div class="Quality__frequently">
    <p>Quality performance success frequently results in higher distribution of shared savings and incentive payments.</p>
  </div>
</div>

This is what I want: It needs to be responsive and support any background colour.

![info blurb image

2

Answers


  1. I think this is possible by the use of html and css like use can use float left property to make the image and text align horizontally and the if you try to add border to div element the image will overflow .so to align it make it come inside the border you can add property like overflow auto to div element.
    Ex:

    <html>
    <head>
    <title>overflow</title>
    <style>
    div{
    overflow:auto;
    }
    img{
    float:right;//your choice you can write left or right
    }
    </style>
    </head>
    <body>
    <div>
    <img src="write the path for image source">
    here you can write the text you want to display.
    </div>
    </body>
    </html>
    Login or Signup to reply.
  2. Here is an example of how you can achieve this.

    • Use a blockquote with a rounded border.
    • Convert the SVG to a data-uri, remove its white background and use it as a :before pseudo-element of the blockquote.
    • Give this :before pseudo-element a background-color so that the blockquote‘s border does not show through.
    • Set the background-color as a css variable so we only have to change it in one place.
    • Wrap the blockquote in a container that we can position and style. This is where the --bg variable is assigned.

    Demo:

    @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&family=Poppins&display=swap');
    :root {
      --bg: #eee;
    }
    html, body {margin:0;}
    body {
      display: grid;
      gap:20px;
      height: 100vh; 
      place-items: center;
      background: var(--bg, #eee);
      font-family: 'Poppins', sans-serif;
      padding:20px;
    }
    /* The above is just for demo. */
    .blockquote-container {
      --bg: white;
      background:var(--bg);
      max-width:min(100%,560px);
      padding:30px;
      border-radius:20px;  
      box-sizing:border-box;
    }
    .blockquote-container.bg2 {
      --bg: #e7e4f0;
    }
    .blockquote-container.bg2:hover {
      --bg: #adb;
    }
    blockquote {
      display:flex;
      box-sizing:border-box;
      align-items: center;
      box-sizing:border-box;
      position:relative;
      border:2px solid #68519f;
      border-radius:8px;
      padding:0.5em 1em;
      background:var(--bg, white);
      font-size:0.8rem;
      margin:0 0 0 30px;
      min-height:4em;
    }
    blockquote:before {
      content:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:serif='http://www.serif.com/' width='100%25' height='100%25' viewBox='0 0 47 44' version='1.1' xml:space='preserve' style='display:none; fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3E%3Cg id='quote'%3E%3Ccircle class='c' cx='21.035' cy='20.84' r='20.775' style='fill:none;'%3E%3C/circle%3E%3Cpath class='c' d='M30.538,34.093l3.75,0.247l6,4.92l0.247,-5.002l3.083,-0.833l1.747,-2.167l0,-14.333l-1.665,-1.417l-2.415,-0.668l-18.832,0.668l0.915,15.165l0.915,2.25l3.502,1.417l2.753,-0.247Z' style='fill:none;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M21.59,43.153c-4.47,-0 -8.925,-1.38 -12.682,-4.103c-9.638,-6.982 -11.79,-20.505 -4.808,-30.142c6.99,-9.638 20.513,-11.79 30.143,-4.808l-0.878,1.215c-8.962,-6.502 -21.547,-4.492 -28.05,4.47c-6.502,8.963 -4.492,21.548 4.47,28.05c6.36,4.605 14.88,5.085 21.713,1.208l0.742,1.305c-3.307,1.875 -6.982,2.805 -10.65,2.805Z' style='fill:%2379cbc5;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M15.133,35.248c-0.12,-0 -0.248,-0.023 -0.368,-0.075c-0.337,-0.143 -0.555,-0.48 -0.555,-0.84l0,-4.688l-0.397,0c-2.483,0 -4.5,-2.025 -4.5,-4.5l-0,-12.255c-0,-2.482 2.017,-4.5 4.5,-4.5l22.68,0c2.482,0 4.5,2.018 4.5,4.5l-0,12.255c-0,2.483 -2.018,4.5 -4.5,4.5l-15.053,0l-5.685,5.355c-0.172,0.165 -0.405,0.248 -0.63,0.248l0.008,-0Zm-1.313,-25.028c-1.462,0 -2.662,1.193 -2.662,2.663l-0,12.255c-0,1.47 1.192,2.662 2.662,2.662l1.313,0c0.502,0 0.915,0.413 0.915,0.915l-0,3.473l4.402,-4.14c0.173,-0.165 0.398,-0.248 0.63,-0.248l15.42,0c1.47,0 2.663,-1.192 2.663,-2.662l-0,-12.255c-0,-1.463 -1.193,-2.663 -2.663,-2.663l-22.68,0Z' style='fill:%2368519f;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M41.878,13.753l-0.878,-0l0,1.837l0.87,0c1.463,0 2.655,1.193 2.655,2.663l0,12.255c0,1.47 -1.192,2.662 -2.655,2.662l-1.312,0c-0.51,0 -0.923,0.413 -0.923,0.923l0,3.472l-4.395,-4.147c-0.172,-0.165 -0.397,-0.248 -0.63,-0.248l-7.815,0c-1.47,0 -2.662,-1.192 -2.662,-2.662l-0,-0.87l-1.838,-0l0,0.87c0,2.482 2.018,4.5 4.5,4.5l7.448,-0l5.685,5.355c0.172,0.165 0.397,0.255 0.63,0.255c0.12,-0 0.247,-0.03 0.367,-0.075c0.338,-0.15 0.555,-0.48 0.555,-0.848l0,-4.687l0.398,-0c2.482,-0 4.5,-2.018 4.5,-4.5l-0,-12.255c-0,-2.483 -2.018,-4.5 -4.5,-4.5Z' style='fill:%2368519f;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M26.99,15.013l-11.91,-0c-0.51,-0 -0.922,-0.413 -0.922,-0.923c-0,-0.51 0.412,-0.922 0.922,-0.922l11.91,-0c0.503,-0 0.915,0.412 0.915,0.922c0,0.51 -0.412,0.923 -0.915,0.923Z' style='fill:%2368519f;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M26.99,19.933l-11.91,-0c-0.51,-0 -0.922,-0.413 -0.922,-0.915c-0,-0.503 0.412,-0.923 0.922,-0.923l11.91,0c0.503,0 0.915,0.413 0.915,0.923c0,0.51 -0.412,0.915 -0.915,0.915Z' style='fill:%2368519f;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M26.99,24.86l-11.91,0c-0.51,0 -0.922,-0.412 -0.922,-0.922c-0,-0.51 0.412,-0.923 0.922,-0.923l11.91,0c0.503,0 0.915,0.413 0.915,0.923c0,0.51 -0.412,0.922 -0.915,0.922Z' style='fill:%2368519f;fill-rule:nonzero;'%3E%3C/path%3E%3Cpath d='M31.003,17.803l-0,-2.108l4.305,0l-0,7.035l1.357,0l0,2.108l-5.662,-0l-0,-2.108l1.387,0l0,-4.927l-1.387,-0Zm1.282,-4.725c0,-0.443 0.158,-0.818 0.465,-1.133c0.315,-0.315 0.69,-0.472 1.125,-0.472c0.435,-0 0.825,0.157 1.133,0.472c0.307,0.315 0.465,0.69 0.465,1.133c-0,0.442 -0.158,0.81 -0.465,1.125c-0.315,0.307 -0.69,0.465 -1.125,0.465c-0.435,-0 -0.81,-0.158 -1.125,-0.473c-0.315,-0.315 -0.473,-0.69 -0.473,-1.117Z' style='fill:%23f38076;fill-rule:nonzero;'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
      width:70px;
      height:67px;
      flex-shrink:0;
      align-self: flex-start;
      margin:-15px 1em -35px -50px;
      background:var(--bg, white);
      border-radius:50% 50% 10px 50%;
    }
    <div class="blockquote-container">
    <blockquote>
    Quality performance success frequently results in higher distribution of shared savings and incentive payments.
    </blockquote>
    </div>
    
    <div class="blockquote-container bg2">
    <blockquote>
    Have a different background colour if you like. The background colour is a css variable so you can add a custom class in your stylesheet or set the `--bg` in your inline style.
    </blockquote>
    </div>
    
    <div class="blockquote-container" style="--bg:#fff9c0">
    <blockquote>
    Resize your browser to see how these flow.
    </blockquote>
    </div>
    
    <blockquote>
    You don't have to have the container but it will fallback to whatever your --bg is set to else white.
    </blockquote>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search