Hide icon before text on overflow - html

On my Website I have some tiles to show some content. Depending on screensize the number of tiles per line is changing. Each tile has a button with an icon and text inside.
My problem is that on some screensizes the button gets to small and therefore the text is displayed in a new line.
What I would like to do is to hide the icon in front of the text when the button gets to small to display both in one line. Is there any way to achieve that?
Example Code:
.container {
display: flex;
flex-wrap: wrap;
}
.tile {
width: 50%;
}
#media screen and (min-width: 350px) {
.tile {
width: 33.3333%;
}
}
#media screen and (min-width: 500px) {
.tile {
width: 25%;
}
}
.tile_content {
margin: 10px;
background: grey;
}
button {
width: 100%;
}
<div class="container">
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
</div>
https://jsfiddle.net/qafc1wd9/

I found this article explaining how to do it:
https://www.freecodecamp.org/news/the-fab-four-technique-to-create-responsive-emails-without-media-queries-baf11fdfa848/
.container {
display: flex;
flex-wrap: wrap;
}
.tile {
width: 50%;
}
#media screen and (min-width: 350px) {
.tile {
width: 33.3333%;
}
}
#media screen and (min-width: 500px) {
.tile {
width: 25%;
}
}
.tile_content {
margin: 10px;
background: grey;
}
button {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
svg {
min-width: 0;
max-width: 30px;
width: calc((100% - 124px)*124);
}
<div class="container">
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
<div class="tile">
<div class="tile_content">
<div>
some content...
</div>
<div>
<button>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" width="30px" height="30px">
<path d="M15,3C8.373,3,3,8.373,3,15c0,6.627,5.373,12,12,12s12-5.373,12-12C27,8.373,21.627,3,15,3z M16,21h-2v-7h2V21z M15,11.5 c-0.828,0-1.5-0.672-1.5-1.5s0.672-1.5,1.5-1.5s1.5,0.672,1.5,1.5S15.828,11.5,15,11.5z" /></svg>
<span>Informations</span>
</button>
</div>
</div>
</div>
</div>
https://jsfiddle.net/0uehno5L/

Related

How do i get my sticky navbar to work using tailwind css?

I am working on a website using tailwindcss. But for some reason the navbar wont work when using the "sticky" class. I tried using the "fixed" class instead, but that did not work with the banner. I have also tried to use:
nav {
position: -webkit-sticky;
position: sticky;
}
but it has been usuccessful. I have also used some other css and javascript to style the searchbar how i want it.
How can i get the navbar to always stick?
Here is the code for the nav and the banner:
<div>
<div>
<nav class="sticky w-full md:flex md:justify-between md:items-center md:flex-wrap px-10 md:px-48 bg-gray-200 py-2"> <!--Navigation-->
<div class="flex md:flex justify-between md:items-center"> <!--Title och Burger button-->
<h1 class="text-xl text-emerald-600">
Logo
</h1>
<div class="px-4 mt-1 justify-end cursor-pointer md:hidden" id="burger">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</div>
</div>
<ul class="md:flex md:flex-1 hidden md:justify-around" id="menu">
<li class="text-">
Home
</li>
<li class="">
About
</li>
<li class="">
Products
</li>
</ul>
<div class="input-container"> <!--Searchbar-->
<input id="in" type="search" placeholder="Search for product" class="border-gray-black rounded-md p-0 input-search-field pl-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hero" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
<button class="md:pr-5">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</button>
</div>
<div class=""> <!--Login/Signup-->
Log in
Sign up
</div>
</nav>
</div>
<div class="relative w-full container"> <!--Banner-->
<img src="img/Banner.png" alt="">
<button class="btn px-4 py-3 bg-blue-600 rounded-md hover:bg-blue-700 transition ease-in-out">Check our products</button>
</div>
<main class="">
</main>
</div>
The css code i used for the searchbar:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
nav {
position: -webkit-sticky;
position: sticky;
}
.input-search-field::-webkit-search-cancel-button {
-webkit-appearance: none;
border-radius: 20px;
}
.input-search-field[type="search"] {
position: relative;
}
.input-container {
display: flex;
align-items: center;
position: relative;
}
.hero {
width: 15px;
position: absolute;
left: 150px;
cursor: pointer;
}
.container .btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
Javascript:
var result = document.querySelector('.hero').addEventListener('click', myfunction)
function myfunction() {
var input = document.querySelector('#in').value="";
}
console.log(result);
const burger = document.querySelector('#burger');
const menu = document.querySelector('#menu');
burger.addEventListener('click', () => {
if (menu.classList.contains('hidden')) {
menu.classList.remove('hidden');
} else {
menu.classList.add('hidden');
}
})
You have to give position sticky to div not in nav and also use top:0px;
HTML Code
<div class="sti">
<nav class="sticky w-full md:flex md:justify-between md:items-center md:flex-wrap px-10 md:px-48 bg-gray-200 py-2"> <!--Navigation-->
<div class="flex md:flex justify-between md:items-center"> <!--Title och Burger button-->
<h1 class="text-xl text-emerald-600">
Logo
</h1>
<div class="px-4 mt-1 justify-end cursor-pointer md:hidden" id="burger">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</div>
</div>
<ul class="md:flex md:flex-1 hidden md:justify-around" id="menu">
<li class="text-">
Home
</li>
<li class="">
About
</li>
<li class="">
Products
</li>
</ul>
<div class="input-container"> <!--Searchbar-->
<input id="in" type="search" placeholder="Search for product" class="border-gray-black rounded-md p-0 input-search-field pl-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hero" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
<button class="md:pr-5">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</button>
</div>
<div class=""> <!--Login/Signup-->
Log in
Sign up
</div>
</nav>
</div>
CSS Code
.sti {
position: -webkit-sticky;
position: sticky;
top: 0px;
}

How to swiper slider mousewhell actions

I have a question.
I want to continue down the page after the slider with the mouse wheel.
So 3 go down after going right. When I go up again, it should go to the left.
Codopen https://codepen.io/xlonely/pen/mdXPdxO
I think I found the solution. Thx.
mousewheel:{
releaseOnEdges:true
},
You can add this code if you want to disable the mousewheel for the swiper after the last slide is shown.
swiper.on('slideChange', function (e) {
if (e.isEnd) {
e.mousewheel.disable();
}
});
Demo
var swiper = new Swiper(".mySwiper", {
direction: "horizontal",
slidesPerView: 1,
speed: 1000,
spaceBetween: 0,
roundLengths: true,
centeredSlides: true,
mousewheel: true,
pagination: {
el: ".swiper-pagination",
clickable: false,
},
});
swiper.on('slideChange', function (e) {
if (e.isEnd) {
e.mousewheel.disable();
}
});
html,
body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper {
width: 100%;
height: 600px;
border: solid 1px black;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
.swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/8.1.4/swiper-bundle.css" integrity="sha512-KBVE5XtR1mD+xG5KJdK4mNAvbqLXeD6fbzeSNGLWRQcOdD6sStIZJIUUIN+ng8glwOzQ2x2uRCWkYkqSQSbGvg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Carousel</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled">Disabled</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
</header>
<main>
<div class="container mb-5">
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
<div class="swiper-pagination"></div>
</div>
</div>
<div class="container marketing">
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"/><text x="50%" y="50%" fill="#777" dy=".3em">140x140</text></svg>
<h2>Heading</h2>
<p>Some representative placeholder content for the three columns of text below the carousel. This is the first column.</p>
<p><a class="btn btn-secondary" href="#">View details »</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"/><text x="50%" y="50%" fill="#777" dy=".3em">140x140</text></svg>
<h2>Heading</h2>
<p>Another exciting bit of representative placeholder content. This time, we've moved on to the second column.</p>
<p><a class="btn btn-secondary" href="#">View details »</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<svg class="bd-placeholder-img rounded-circle" width="140" height="140" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 140x140" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#777"/><text x="50%" y="50%" fill="#777" dy=".3em">140x140</text></svg>
<h2>Heading</h2>
<p>And lastly this, the third column of representative placeholder content.</p>
<p><a class="btn btn-secondary" href="#">View details »</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
<!-- START THE FEATURETTES -->
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">First featurette heading. <span class="text-muted">It’ll blow your mind.</span></h2>
<p class="lead">Some great placeholder content for the first featurette here. Imagine some exciting prose here.</p>
</div>
<div class="col-md-5">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500" height="500" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 500x500" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#eee"/><text x="50%" y="50%" fill="#aaa" dy=".3em">500x500</text></svg>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7 order-md-2">
<h2 class="featurette-heading">Oh yeah, it’s that good. <span class="text-muted">See for yourself.</span></h2>
<p class="lead">Another featurette? Of course. More placeholder content here to give you an idea of how this layout would work with some actual real-world content in place.</p>
</div>
<div class="col-md-5 order-md-1">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500" height="500" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 500x500" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#eee"/><text x="50%" y="50%" fill="#aaa" dy=".3em">500x500</text></svg>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">And lastly, this one. <span class="text-muted">Checkmate.</span></h2>
<p class="lead">And yes, this is the last block of representative placeholder content. Again, not really intended to be actually read, simply here to give you a better view of what this would look like with some actual content. Your content.</p>
</div>
<div class="col-md-5">
<svg class="bd-placeholder-img bd-placeholder-img-lg featurette-image img-fluid mx-auto" width="500" height="500" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Placeholder: 500x500" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#eee"/><text x="50%" y="50%" fill="#aaa" dy=".3em">500x500</text></svg>
</div>
</div>
<hr class="featurette-divider">
<!-- /END THE FEATURETTES -->
</div><!-- /.container -->
<footer class="container">
<p class="float-end">Back to top</p>
<p>© 2017–2021 Company, Inc. · Privacy · Terms</p>
</footer>
</main>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/8.1.4/swiper-bundle.min.js" integrity="sha512-hNnjFWCqifslGhuZJVHjXdBund00oDV71mBacLyZYVwmuf+Lx+MGgoG04wehsvhp6FvLYfycrES+b1yh24yvhg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="assets/js/main.js"></script>
</body>
</html>

Overlay a Bootstrap Row completely

In many web environments with some degree of interaction among Users, if the platform allows, one can block another and effectively not even see the blocked person' posts.
Thinking about it, I decided to implement such a feature in a commenting system I made. Here's a fragment of it.
Through a class .blocked added to the wrapper of two Bootstrap 5 .row, I managed to style the pseudo-selector ::before to cover the whole content as desired, but in order to add some text in a non-hard-coded way, I ended up having to use a data-attribute.
It works, yes, but even though the visual background extends to the whole width, this added content does not, it gets limited by the width of these two rows within.
Also, it's not very much flexible as it limits my customization options, especially through Javascript, since I don't have other tags within to manipulate.
So, how could I accomplish my goal in a flexible way?
html,
body {
height: 100%;
width: 75%;
margin-top: 5%;
}
.wrapper {
min-height: 100vh;
height: 100vh;
}
main {
flex: 1;
}
/** This is not really hard-coded like, but... */
#comment_851030477 {
border: 1px solid black;
padding: 1rem;
}
.blocked {
background-color: #000;
display: flex;
bottom: 0;
left: 0;
position: relative;
top: 0;
}
.blocked>* {
visibility: hidden;
}
.blocked::before {
align-self: center;
color: #FFF;
content: attr(data-blocked);
display: flex;
margin: -1rem;
visibility: visible;
width: 100%;
}
.picture {
border: 1px solid blue;
}
/** Icons */
.icon {
-ms-flex-item-align: center;
align-self: center;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.icon.edit,
.icon.delete {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
.icon.block,
.icon.unblock {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
.icon.follow,
.icon.unfollow {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<main class="container-fluid">
<div class="row w-100 px-3">
<div class="col">
<section>
<div class="container blocked" id="comment_851030477" data-blocked="THIS USER IS BLOCKED">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="d-none block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
<div class="container mt-3" id="comment_851030477">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture foil"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
</section>
</div>
</div>
</main>
After cooling down a bit, I decided to have all of the necessary markup ready with control-classes to be manipulated with Javascript.
This is the final result, despite the positioning awkwardness and the fact SVG icons remain visible here.
$( '#comments' ).on( 'click', '.blocked a.reveal', function() {
$( this ).closest( '.container' )
.removeClass( 'blocked' )
.find( '.blocked-overlay' )
.addClass( 'd-none' );
})
html, body {
height: 100%;
width: 75%;
margin-top: 5%;
}
.wrapper {
min-height: 100vh;
height: 100vh;
}
main {
flex: 1;
}
/** This is not really hard-coded like this, but... */
#comment_851030477 {
border: 1px solid black;
padding: 1rem;
position: relative;
}
.blocked .blocked-overlay {
background-color: #FFF;
display: flex;
flex-direction: column;
height: 100%;
justify-content: center;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 1;
}
.blocked .blocked-overlay .reveal {
margin-left: .3rem;
}
.picture {
border: 1px solid blue;
}
/** Icons */
.icon {
-ms-flex-item-align: center;
align-self: center;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.icon.edit, .icon.delete {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
.icon.block, .icon.unblock {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
.icon.follow, .icon.unfollow {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body class="d-flex flex-column" data-loaded="true">
<main class="container-fluid">
<div class="row w-100 px-3">
<div class="col">
<section id="comments">
<div class="container blocked" id="comment_851030477">
<div class="blocked-overlay">
<p class="d-inline-flex justify-content-center">
You have blocked the author of this comment
</p>
<p class="d-inline-flex justify-content-center">
If you still want to see it,
<a href="javascript:void(0)" class="reveal">
<span>click here</span>
</a>
</p>
</div>
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="d-none block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
<div class="container mt-3" id="comment_851030477">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture foil"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
</section>
</div>
</div>
</main>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="edit-symbol" viewBox="0 0 24 24">
<path d="M20.719 7.031l-1.828 1.828-3.75-3.75 1.828-1.828q0.281-0.281 0.703-0.281t0.703 0.281l2.344 2.344q0.281 0.281 0.281 0.703t-0.281 0.703zM3 17.25l11.063-11.063 3.75 3.75-11.063 11.063h-3.75v-3.75z" />
</symbol>
<symbol id="delete-symbol" viewBox="0 0 24 24">
<path d="M18.984 3.984v2.016h-13.969v-2.016h3.469l1.031-0.984h4.969l1.031 0.984h3.469zM6 18.984v-12h12v12q0 0.797-0.609 1.406t-1.406 0.609h-7.969q-0.797 0-1.406-0.609t-0.609-1.406z" />
</symbol>
<symbol id="block-symbol" viewBox="0 0 24 28">
<path d="M20.5 13.953c0-1.703-0.5-3.281-1.359-4.609l-11.781 11.766c1.344 0.875 2.938 1.391 4.641 1.391 4.688 0 8.5-3.828 8.5-8.547zM4.891 18.625l11.797-11.781c-1.344-0.906-2.953-1.422-4.688-1.422-4.688 0-8.5 3.828-8.5 8.531 0 1.734 0.516 3.328 1.391 4.672zM24 13.953c0 6.656-5.375 12.047-12 12.047s-12-5.391-12-12.047c0-6.641 5.375-12.031 12-12.031s12 5.391 12 12.031z"/>
</symbol>
<symbol id="unblock-symbol" viewBox="0 0 24 24">
<path d="M11.859 9h0.141q1.219 0 2.109 0.891t0.891 2.109v0.188zM7.547 9.797q-0.563 1.125-0.563 2.203 0 2.063 1.477 3.539t3.539 1.477q1.078 0 2.203-0.563l-1.547-1.547q-0.375 0.094-0.656 0.094-1.219 0-2.109-0.891t-0.891-2.109q0-0.281 0.094-0.656zM2.016 4.266l1.266-1.266 17.719 17.719-1.266 1.266q-0.234-0.234-1.477-1.453t-1.898-1.875q-2.016 0.844-4.359 0.844-3.703 0-6.703-2.063t-4.313-5.438q0.516-1.219 1.617-2.695t2.133-2.273q-0.563-0.563-1.57-1.594t-1.148-1.172zM12 6.984q-0.938 0-1.828 0.375l-2.156-2.156q1.828-0.703 3.984-0.703 3.703 0 6.68 2.063t4.289 5.438q-1.125 2.766-3.422 4.734l-2.906-2.906q0.375-0.891 0.375-1.828 0-2.063-1.477-3.539t-3.539-1.477z"></path>
</symbol>
<symbol id="follow-symbol" viewBox="0 0 32 28">
<path d="M11 14c-3.313 0-6-2.688-6-6s2.688-6 6-6 6 2.688 6 6-2.688 6-6 6zM26 16h5.5c0.266 0 0.5 0.234 0.5 0.5v3c0 0.266-0.234 0.5-0.5 0.5h-5.5v5.5c0 0.266-0.234 0.5-0.5 0.5h-3c-0.266 0-0.5-0.234-0.5-0.5v-5.5h-5.5c-0.266 0-0.5-0.234-0.5-0.5v-3c0-0.266 0.234-0.5 0.5-0.5h5.5v-5.5c0-0.266 0.234-0.5 0.5-0.5h3c0.266 0 0.5 0.234 0.5 0.5v5.5zM14.5 19.5c0 1.094 0.906 2 2 2h4v3.719c-0.766 0.562-1.734 0.781-2.672 0.781h-13.656c-2.5 0-4.172-1.5-4.172-4.047 0-3.531 0.828-8.953 5.406-8.953 0.25 0 0.422 0.109 0.609 0.266 1.531 1.172 3.016 1.906 4.984 1.906s3.453-0.734 4.984-1.906c0.187-0.156 0.359-0.266 0.609-0.266 1.328 0 2.5 0.5 3.391 1.5h-3.484c-1.094 0-2 0.906-2 2v3z"/>
</symbol>
<symbol id="unfollow-symbol" viewBox="0 0 32 28">
<path d="M11 14c-3.313 0-6-2.688-6-6s2.688-6 6-6 6 2.688 6 6-2.688 6-6 6zM27.828 19l3.891 3.891c0.094 0.094 0.141 0.219 0.141 0.359 0 0.125-0.047 0.25-0.141 0.344l-2.125 2.125c-0.094 0.094-0.219 0.141-0.344 0.141-0.141 0-0.266-0.047-0.359-0.141l-3.891-3.891-3.891 3.891c-0.094 0.094-0.219 0.141-0.359 0.141-0.125 0-0.25-0.047-0.344-0.141l-2.125-2.125c-0.094-0.094-0.141-0.219-0.141-0.344 0-0.141 0.047-0.266 0.141-0.359l3.891-3.891-3.891-3.891c-0.094-0.094-0.141-0.219-0.141-0.359 0-0.125 0.047-0.25 0.141-0.344l2.125-2.125c0.094-0.094 0.219-0.141 0.344-0.141 0.141 0 0.266 0.047 0.359 0.141l3.891 3.891 3.891-3.891c0.094-0.094 0.219-0.141 0.359-0.141 0.125 0 0.25 0.047 0.344 0.141l2.125 2.125c0.094 0.094 0.141 0.219 0.141 0.344 0 0.141-0.047 0.266-0.141 0.359zM20.047 19l-2.828 2.828c-0.375 0.375-0.578 0.891-0.578 1.422 0 0.516 0.203 1.031 0.578 1.406l1.297 1.297c-0.219 0.031-0.453 0.047-0.688 0.047h-13.656c-2.5 0-4.172-1.5-4.172-4.047 0-3.531 0.828-8.953 5.406-8.953 0.25 0 0.422 0.109 0.609 0.266 1.5 1.188 3.031 1.906 4.984 1.906s3.484-0.719 4.984-1.906c0.187-0.156 0.359-0.266 0.609-0.266 0.297 0 0.594 0.031 0.891 0.094-0.516 0.5-0.844 0.906-0.844 1.656 0 0.531 0.203 1.047 0.578 1.422z"/>
</symbol>
</defs>
<g id="edit">
<use xlink:href="#edit-symbol"/>
</g>
<g id="delete">
<use xlink:href="#delete-symbol"/>
</g>
<g id="block">
<use xlink:href="#block-symbol"/>
</g>
<g id="unblock">
<use xlink:href="#unblock-symbol"/>
</g>
<g id="follow">
<use xlink:href="#follow-symbol"/>
</g>
<g id="unfollow">
<use xlink:href="#unfollow-symbol"/>
</g>
</svg>
</body>
</html>
During the loop where I render each entry, if I receive the Response indicating a User is blocked I add the class .blocked to the parent container and flip the displayability of the inner .blocked-overlay by removing Bootstrap's d-none
Then, separately, I attach a simple Event Handler to temporarily reveal the hidden content.

How to align svg icon and text content in same line towards right side (Right aligned) in bootstrap

I have tried to align icon and text towards right side. But its not happening. am attaching the design herewith.
I tried code below - please let me know if there is any options available.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<div class="col-1 icon1">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="#2DB757" class="bi bi-circle-fill float-right" style="margin: 18px;">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Completed</div>
</div>
You can use flexbox to move the element to right
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-12 icon1">
<div class="d-flex justify-content-end align-items-center">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="orange" class="bi bi-circle-fill">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Not Started</div>
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="red" class="bi bi-circle-fill">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Progress</div>
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="#2DB757" class="bi bi-circle-fill">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Completed</div>
</div>
</div>
</div>
</div>
While you work on improving the question, I'll take a guess at what you might need. By putting a flexbox class on the row and adding an empty flex column we push the small fixed-width column to the right.
Note that the correct column class for Bootstrap 4 is col-xs-1. Be sure you're following the correct version documentation.
.col {
background: pink;
}
.col-xs-1 {
background: #ddd;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<div class="container">
<div class="row d-flex">
<div class="col"></div>
<div class="col-xs-1 icon1">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="#2DB757" class="bi bi-circle-fill float-right" style="margin: 18px;">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Completed</div>
</div>
</div>
</div>
To give the layout a more modern, fully-flexible fit, use only flex classes (including on the icon container):
.d-flex > div {
background: pink;
}
.d-flex > div:last-child {
background: #ddd;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<div class="container">
<div class="d-flex">
<div class="flex-grow-1"></div>
<div class="icon1 d-flex">
<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" fill="#2DB757" class="bi bi-circle-fill float-right" style="margin: 18px;">
<circle cx="8" cy="8" r="8"/>
</svg>
<div class="p-2" id="numOfStatus">Completed</div>
</div>
</div>
</div>

Complex design pattern - overlapping transparent shapes?

I'm trying to create following shape.
Almost I tried to create this image by following way. In order create this Image using HTML and CSS. I tried to use following code.
.left1{
float:left;
transform: rotate(180deg);
}
.halfCircleRight1{
height: 70px;
width: 70px;
border-top-right-radius: 10em;
border-bottom-right-radius: 10em;
background: #326d7d;
}
.halfCoverTop1 {
height: 35px;
width: 35px;
border-bottom-right-radius: 10em;
background: #ffffff;
}
.halfCoverBottom1{
height: 35px;
width: 35px;
border-top-right-radius: 10em;
background: #ffffff;
}
.left{
float:left;
}
.halfCircleRight{
height: 70px;
width: 70px;
border-top-right-radius: 10em;
border-bottom-right-radius: 10em;
background: #b1a51f;
}
.halfCoverTop {
height: 35px;
width: 35px;
border-bottom-right-radius: 10em;
background: #ffffff;
}
.halfCoverBottom{
height: 35px;
width: 35px;
border-top-right-radius: 10em;
background: #ffffff;
}
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left">
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
<div class="halfCircleRight">
<div class="halfCoverTop"></div>
<div class="halfCoverBottom"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
<div class="left1">
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
<div class="halfCircleRight1">
<div class="halfCoverTop1"></div>
<div class="halfCoverBottom1"></div>
</div>
</div>
But some where I'm going wrong to achieve my desires output.I'm not able to figure out my approach. Could any one can please help achieve my actual output.
There are multiple possibilities to create this shape. Each one has its own pros and cons. You may decide which best suits your needs.
SVG Based Approach:
SVG is the recommneded and more appropriate way to create such shapes.
Step #1:
The idea is to draw a small component that is being repeated in your shape and then repeat it using SVG's patterns. We can use SVG's path element to create this shape and fill it with some color, gradient or pattern.
Only one attribute d is used to define shapes in path element. This attribute itself contains a number of short commands and few parameters that are necessary for those commands to work.
Below is the necessary code to create this shape:
<path d="M 0,.125
Q .110,.114 .125,0
A .125,.125 0 0 1 .125,.250
Q .110,.136 0,.125" />
I've used 3 commands inside path element. Below is a brief description:
M command is used to define the starting point. It appears at the beginning and specify the point from where drawing should start.
Q command is used to draw curves.
A command is also used to draw curves.
Working Example:
body {
background-color: #ececec;
}
svg {
margin: 10px auto;
display: block;
}
<svg width="170" height="170" viewBox="0 0 50 50">
<path d="M 0,25
Q 22,22 25,0
A 25,25 0 0 1 25,50
Q 22,28 0,25" fill="#aba219" fill-opacity="inherit" />
</svg>
Output Image:
Below is the output of first step:
Step #2:
Now we will create a pattern that will repeat this shape. After creating this we will be a bit more closer to the final output.
Consider the below code:
<defs>
<pattern id="pattern1" x="0" y="0" width="25%" height="25%"
patternUnits="objectBoundingBox"
patternContentUnits="objectBoundingBox">
<path id="tile" fill="inherit" fill-opacity="inherit"
d="M 0,.125
Q .110,.114 .125,0
A .125,.125 0 0 1 .125,.250
Q .110,.136 0,.125" />
</pattern>
</defs>
<rect x="0" y="0" width="200" height="200" fill="url(#pattern1)" />
Below is a brief description of above code:
SVG's <defs> element is used to define graphics/elements for later use. Objects defined inside defs are not drawn immediately on screen. They will be referenced by other parts of the code in future.
The <pattern> element defines a graphics object which can be redrawn at repeated x and y-coordinate intervals ("tiled") to cover an area. This pattern will be referenced by fill / stroke attributes of graphics elements.
<rect> element is used to draw rectangular area on screen. Notice the fill attribute used on this element. This attribute is referencing the pattern defined above in <defs> section. Now we are actually using this pattern to fill the rectangular area.
Working Example:
body {
background-color: #ececec;
}
svg {
margin: 0 auto;
display: block;
}
<svg width="200" height="200" viewBox="0 0 200 200">
<defs>
<path id="tile" fill="inherit" fill-opacity="inherit"
d="M 0,.125
Q .110,.114 .125,0
A .125,.125 0 0 1 .125,.250
Q .110,.136 0,.125" />
<pattern id="pattern1" x="0" y="0" width="25%" height="25%"
patternUnits="objectBoundingBox"
patternContentUnits="objectBoundingBox">
<use href="#tile" fill="#aba219" />
</pattern>
</defs>
<rect x="0" y="0" width="200" height="200" fill="url(#pattern1)" />
</svg>
Output Image:
Below is the result till now:
Step #3:
Finally we will create two patterns and apply it on 2 different <rect> elements to create the final output.
Following code pattern will be used to create final output:
<defs>
<path id="tile" d="..." />
<pattern id="pattern1">
<use href="#tile" fill="#aba219" />
</pattern>
<pattern id="pattern2" patternTransform="scale(-1)">
<use href="#tile" fill="#023e54" />
</pattern>
</defs>
<rect width="200" height="880" fill="url(#pattern1)" />
<rect width="200" height="200" fill="url(#pattern2)" />
Most of the code is similar as described above. However notice the use of <use> element. Instead of defining path element in each pattern element, we have defined it once and copying it in 2 other places with <use> element.
The <use> element takes nodes from within the SVG document, and duplicates them somewhere else.
Working Example:
body {
background-color: #ececec;
}
svg {
margin: 0 auto;
display: block;
}
<svg width="190" height="190" viewBox="0 0 990 990">
<defs>
<path id="tile" fill="inherit" fill-opacity="inherit"
d="M 0,.125
Q .110,.114 .125,0
A .125,.125 0 0 1 .125,.250
Q .110,.136 0,.125" />
<pattern id="pattern1" x="0" y="0" width="25%" height="25%"
patternUnits="objectBoundingBox"
patternContentUnits="objectBoundingBox">
<use href="#tile" fill="#aba219" />
</pattern>
<pattern id="pattern2" x="0" y="0" width="25%" height="25%"
patternUnits="objectBoundingBox"
patternContentUnits="objectBoundingBox"
patternTransform="scale(-1)">
<use href="#tile" fill="#023e54" fill-opacity="0.7" />
</pattern>
</defs>
<rect x="0" y="0" width="880" height="880" fill="url(#pattern1)" />
<rect x="110" y="110" width="880" height="880" fill="url(#pattern2)" />
</svg>
Output Image:
Below is the final output image:
HTML/CSS Based Approach:
Although possible but I won't recommend this because a lot of elements will be required to create this shape which is won't be an efficient approach.
Working Example:
body {
background-color: #ececec;
}
.tile-list {
list-style: none;
margin: 0 auto;
width: 225px;
padding: 0;
}
.tile-list li {
display: flex;
}
.tile-list li:nth-child(even) {
position: relative;
padding-left: 25px;
margin: -25px 0;
z-index: 1;
}
.tile {
border-radius: 100%;
position: relative;
overflow: hidden;
height: 50px;
width: 50px;
}
.tile .left {
position: absolute;
overflow: hidden;
height: 50%;
width: 50%;
left: 0;
top: 0;
}
.tile .left.bottom {
bottom: 0;
top: auto;
}
.tile .left::before {
box-shadow: 0 0 0 10px #aba219;
border-radius: 100%;
position: absolute;
overflow: hidden;
content: '';
height: 200%;
width: 200%;
left: -100%;
top: -100%;
}
.tile .left.bottom::before {
bottom: -100%;
top: auto;
}
.tile .right {
position: absolute;
overflow: hidden;
height: 100%;
width: 100%;
left: 50%;
top: 0;
}
.tile .right::before {
background-color: #aba219;
position: absolute;
height: 100%;
content: '';
width: 100%;
left: -50%;
top: 0;
}
.tile-list li:nth-child(even) .tile {
transform: scale(-1);
}
.tile-list li:nth-child(even) .tile .right::before {
background-color: rgb(2, 62, 84, 0.7);
}
.tile-list li:nth-child(even) .tile .left::before {
box-shadow: 0 0 0 10px rgb(2, 62, 84, 0.7);
}
<ul class="tile-list">
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
<li>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
<div class="tile">
<div class="left top"></div>
<div class="left bottom"></div>
<div class="right"></div>
</div>
</li>
</ul>
What about another idea using some SVG, pseudo-element and multiple background:
.box {
margin:60px;
width:450px;
height:250px;
background:
url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="rgb(177, 165, 31,0.8)"/></svg>') -50px -50px /100px 100px,
url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-90 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="%23326d7d" transform="scale(-1,1)"/></svg>') 0px 0px/100px 100px;
position:relative;
}
.box:before {
content:"";
position:absolute;
top:-50px;
height:50px;
left:0;
right:0;
background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="rgb(177, 165, 31,0.8)"/></svg>') 50px 0 /100px 100px;
}
.box:after {
content:"";
position:absolute;
bottom:-50px;
height:50px;
left:0;
right:0;
background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-90 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="%23326d7d" transform="scale(-1,1)"/></svg>')0px -50px/100px 100px ;
}
.intern {
height:100%;
position:relative;
}
.intern:before {
content:"";
position:absolute;
top:-50px;
bottom:0;
left:-50px;
width:50px;
background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="rgb(177, 165, 31,0.8)"/></svg>') 0 0 /100px 100px;
}
.intern:after {
content:"";
position:absolute;
top:0;
bottom:-50px;
right:-50px;
width:50px;
background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-90 10 75 80" width="100"><path d="M50 10 C 100 10, 100 90, 50 90 C 50 65, 35 50, 10 50 C 35 50, 50 35, 50 10" fill="%23326d7d" transform="scale(-1,1)"/></svg>')-50px 0/100px 100px;
}
<div class="box">
<div class="intern"></div>
</div>
UPDATE
Here is another idea without the use of SVG and only CSS (I will rely on radial-gradient):
.container {
position:relative;
width:400px;
z-index:0;
}
.bottom {
position:absolute;
z-index:-1;
top:0;
left:0;
transform:translate(50px,50px);
}
.top >div,
.bottom >div{
width:100px;
height:100px;
border-radius:50%;
display:inline-block;
background-size:100% 50%;
background-position:top,bottom;
background-repeat:no-repeat;
}
.top >div {
background-image:
radial-gradient(circle at top left, transparent 44%, rgb(177, 165, 31,0.8) 44.5%),
radial-gradient(circle at bottom left,transparent 44%, rgb(177, 165, 31,0.8) 44.5%);
}
.bottom >div {
background-image:
radial-gradient(circle at top right, transparent 44%, #326d7d 44.5%),
radial-gradient(circle at bottom right,transparent 44%, #326d7d 44.5%);
}
<div class="container">
<div class="top">
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
</div>
<div class="bottom">
<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
</div>
</div>