{"id":4387,"date":"2017-10-03T13:00:31","date_gmt":"2017-10-03T04:00:31","guid":{"rendered":"https:\/\/tadtadya.com\/en\/?p=4387"},"modified":"2021-01-25T14:26:42","modified_gmt":"2021-01-25T05:26:42","slug":"how-to-make-balloons-with-just-html-and-css","status":"publish","type":"post","link":"https:\/\/tadtadya.com\/en\/how-to-make-balloons-with-just-html-and-css\/","title":{"rendered":"HTML&#038;CSS, How to make a balloon"},"content":{"rendered":"\n<p>This is a method of creating speech bubbles using only HTML and CSS without images.<\/p>\n\n\n\n<p>Since it doesn't load images, it reduces the response time and page display time a bit.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-origin-block-msg-box\"><div class=\"msgbox msgbox-notice v1\"><i class=\"fas fa-exclamation-triangle icon\"><\/i><div class=\"msg\">\n<p>This is written by a Japanese who can't speak English with the help of translation application. Sorry if it's not good.<\/p>\n<\/div><\/div><\/div>\n\n\n\n<p>Creating with just HTML and CSS won't make much of a difference in response time or page display time compared to the balloon using images or canvas.<\/p>\n\n\n\n<p>However, since it uses only the basic functions of CSS, these small steps can lead to big improvements.<\/p>\n\n\n\n<p>(But there's a weakness with the larger CSS size.)<\/p>\n\n\n\n<p>Let's take a look at HTML and CSS and the results.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\">Placed on top<\/h2>\n\n\n\n<p class=\"codepen\" data-height=\"264\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"VMMjYd\" style=\"height: 264px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon top\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/VMMjYd\" class=\"broken_link\">\n  Balloon top<\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The size of the balloon's arrow part changes depending on the size of the \"border\" property of \".balloon::before\" and \".balloon::after\".<\/p>\n\n\n\n<p>Adjust the position of the balloon's arrow with the \"margin-bottom\" property of \".balloon\" and the \"left\" and \"top\" properties of \".balloon::before\" and \".balloon::after\".<\/p>\n\n\n\n<h2 class=\"is-style-h2df\">Placed under<\/h2>\n\n\n\n<p class=\"codepen\" data-height=\"265\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"Bwwzda\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon bottom\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/Bwwzda\" class=\"broken_link\">\n  Balloon bottom<\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The balloons are adjusted in the same way as the above placement, except the properties used are different.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\">Placed to the left<\/h2>\n\n\n\n<p class=\"codepen\" data-height=\"265\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"booeQe\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon left\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/booeQe\" class=\"broken_link\">\n  Balloon left<\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The same way to adjust the balloon.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\">Placed to the right<\/h2>\n\n\n\n<p class=\"codepen\" data-height=\"265\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"eGGzqM\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon right  \">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/eGGzqM\" class=\"broken_link\">\n  Balloon right  <\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The same way to adjust the balloon.<\/p>\n\n\n\n<h2 class=\"is-style-h2df\">About the balloon arrows<\/h2>\n\n\n\n<p>The balloon's arrows make use of the corner feature of the \"border\" property. Take a look at the following sample.<\/p>\n\n\n\n<p class=\"codepen\" data-height=\"265\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"KXXgVy\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon triangle\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/KXXgVy\" class=\"broken_link\">\n  Balloon triangle<\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The \"top\", \"left\", \"right\", and \"bottom\" properties of the border are separated by a diagonal line connecting the corners of the outer and inner borders.<\/p>\n\n\n\n<p>A triangle with a balloon's arrow uses this part of the border. For example, a downward-pointing triangle would look like this.<\/p>\n\n\n\n<p class=\"codepen\" data-height=\"265\" data-theme-id=\"default\" data-default-tab=\"result\" data-user=\"tadtadya\" data-slug-hash=\"JrrRNQ\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Balloon triangle bottom\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/tadtadya\/pen\/JrrRNQ\" class=\"broken_link\">\n  Balloon triangle bottom<\/a> by tadtadya (<a href=\"https:\/\/codepen.io\/tadtadya\" class=\"broken_link\">@tadtadya<\/a>)\n  on <a href=\"https:\/\/codepen.io\" class=\"broken_link\">CodePen<\/a>.<\/span>\n<\/p>\n<script async=\"\" src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n\n\n\n<p>The size of the component is 0 and there is no substance, and the \"border-left\", \"border-right\", and \"border-top\" properties turn the \"border-top\" into a triangle.<\/p>\n\n\n\n<p>In the balloon, I created a pseudo-element of \"::before\" and \"::after\".<\/p>\n\n\n\n<p>By placing the triangle of \"::after\" on top of \"::before\" and shifting it slightly, the triangle line is created.<\/p>\n\n\n\n<p>In this case, I did this because the background of the bubble was white. If the balloon background is not white and you don't want a balloon border, you don't need to use \"::after\".<\/p>\n\n<!-- WP QUADS Content Ad Plugin v. 2.0.65.1 -->\n<div class=\"quads-location quads-ad2\" id=\"quads-ad2\" style=\"float:none;margin:0px;\">\n<ul class=\"quads-location-ul\">\r\n<li class=\"quads-location-li li-1\">\r\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-4926008942376207\"\r\n     data-ad-slot=\"6550760310\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\r\n<\/li>\r\n<li class=\"quads-location-li li-2\">\r\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-4926008942376207\"\r\n     data-ad-slot=\"6550760310\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\r\n<\/li>\r\n<\/ul>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>This is a method of creating speech bubbles using only HTML and CSS without images. Since it doesn't load images, it reduces the response time and page display time a bit.<\/p>\n","protected":false},"author":1,"featured_media":12430,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"How to make balloons with just HTML and CSS\r\n#HTML #CSS #make_a_balloon_with_only_HTML_CSS","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_options":[]},"categories":[9,43,267,302],"tags":[185,186,306],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/tadtadya.com\/en\/wp-content\/uploads\/sites\/2\/2018\/10\/html5-css3-2-1.png?fit=1280%2C671&ssl=1","jetpack_sharing_enabled":false,"jetpack_shortlink":"https:\/\/wp.me\/p8Qw77-18L","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts\/4387"}],"collection":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/comments?post=4387"}],"version-history":[{"count":0,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/posts\/4387\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/media\/12430"}],"wp:attachment":[{"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/media?parent=4387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/categories?post=4387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tadtadya.com\/en\/wp-json\/wp\/v2\/tags?post=4387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}