Create a thought bubble in css

Asked

Viewed 140 times

0

.balloon-box {
    width: 281px;
    height: 53px;
    background: #f1f1f1;
    border-radius: 26.5px;
    text-align: center;
}

.balloon-box::after {
    content: "";
    display: block;
    width: 17px;
    height: 17px;
    border-radius: 100%;
    background: #f1f1f1;
    position: relative;
    float: right;
    margin: 10px 30px 0 0;
}
<div class="balloon-box balloon-circle">
    <p class="balloon-text">I can help marketing strategy</p>
</div>

Hello, could someone help me create this balloon equal to the image, only in css?

inserir a descrição da imagem aqui

2 answers

4


Since you’re wearing one pseudo::after, use a ::before to make the other ball

The shadow that is the cat jump, to make the most practical form I found was using a filter: drop-shadow, because it puts the shadow on the "content" and not exactly on the edge of the box-model as would be the case with box-shadow.

inserir a descrição da imagem aqui

OBS: Filters have excellent support, but it doesn’t work in IE (who turns on rss) https://caniuse.com/#feat=css-Filters

body {
  background: pink;
}
.balloon-box {
  width: 281px;
  height: 53px;
  background: #f1f1f1;
  border-radius: 26.5px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.balloon-box::after {
  content: "";
  display: block;
  width: 17px;
  height: 17px;
  border-radius: 100%;
  background: #f1f1f1;
  position: absolute;
  bottom: -7px;
  right: 30px;
}
.balloon-box::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 100%;
  background: #f1f1f1;
  position: absolute;
  right: 15px;
  bottom: -21px;
}
.balloon-box {
  filter: drop-shadow(0 0 3px rgba(0,0,0,.5));
}
<div class="balloon-box balloon-circle">
    <p class="balloon-text">I can help marketing strategy</p>
</div>

  • Dude thanks bro, I was walking in circles here, thanks msm.

  • 1

    @Gabriel no problem my dear this kind of shading is pretty boring when you don’t know the technique

1

<!DOCTYPE html>
<html>
<head>
	<title>p</title>

<style>

body {
	background-color: pink;
}

div {
	width: 400px;
	height: 70px;
	background-color: #ffffff;
	border-radius: 50px;
	border: ;
	text-align: center;
	font-size: 15pt;
	line-height: 65px;
}

.balloon-text {
	color: #000000;
	font-weight: bold;
}

p#max {
	position: absolute;
	width: 40px;
	height: 40px;
	top: 45px;
	left: 320px;
	border-radius: 40px;
	background-color: #ffffff;
}

p#min {
	position: absolute;
	width: 20px;
	height: 20px;
	top: 90px;
	left: 370px;
	border-radius: 50px;
	background-color: #ffffff;	
}
</style>

</head>

<body>

<div>
	<div class="balloon">
		<p class="balloon-text">I can help marketing strategy</p>
		<p id="max"></p>
		<p id="min"></p>
	</div>
</div>


</body>
</html>

  • 1

    It was cool. Just missed the shading.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.