考えごと風、顔つき吹き出し
サルワカさんの CSSで作る!吹き出しデザインのサンプル19選からのコピペです。
5つ目の “考えごと風” の吹き出しを “会話風” にして、使わせていただいてます。
スマホで見ると、フェイスアイコンとコメントの間にある、大小の丸が、あらぬ方向に行ってしまうので、
ここだけ、レスポンシブルで変更してます。
before と after で、bottom の数字を調整してます。
“考えごと風” と “会話風” を、組み合わせたので、クラス名を変更してます。色は、このブログと同色になってます。
◎html
- <div class="balloon-think">
- <div class="faceicon"><img src="キャラクター画像url"></div>
- <div class="chatting">
- <div class="kotoba">
- <p>コメント</p>
- </div>
- </div>
- </div>
◎css
- .balloon-think {
- width: 95%;
- margin: 0.5em 0;
- overflow: hidden;
- }
- .balloon-think .faceicon {
- float: left;
- margin-right: -90px;
- margin: 1em 0;
- width: 70px;
- }
- .balloon-think .faceicon img{
- width: 100%;
- height: auto;
- border: solid 4px #A52A2A;
- border-radius: 50%;
- box-shadow:2px 2px 2px #FD2D2D2;
- }
- .balloon-think .chatting {
- width: 100%;
- }
- .kotoba {
- position: relative;
- margin: 0em 0 2em 108px;
- padding: 15px;
- background: #ECDE99;
- border-radius: 30px;
- box-shadow:2px 2px 2px #Fcdcdcd;
- }
- .kotoba:before {
- content: "";
- position: absolute;
- left: -38px;
- width: 12px;
- height: 12px;
- bottom: 25px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- .kotoba:after {
- content: "";
- position: absolute;
- left: -24px;
- width: 19px;
- height: 18px;
- bottom: 35px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- .kotoba p {
- margin: 0;
- padding: 0;
- }
- /*-----スマホ-----*/
- @media screen and (max-width:480px) {
- .kotoba:before {
- content: "";
- position: absolute;
- left: -38px;
- width: 13px;
- height: 12px;
- bottom: 70px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- .kotoba:after {
- content: "";
- position: absolute;
- left: -24px;
- width: 20px;
- height: 18px;
- bottom: 80px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- }
iPhone用 文字を小さくして、もっと位置を上げてます。
- @media screen and (max-width: 320px) {
- .kotoba:before {
- content: "";
- position: absolute;
- left: -38px;
- width: 13px;
- height: 12px;
- bottom: 120px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- .kotoba:after {
- content: "";
- position: absolute;
- left: -24px;
- width: 20px;
- height: 18px;
- bottom: 130px;
- background: #ECDE99;
- border-radius: 50%;
- box-shadow:2px 2px 2px #cdcdcd;
- }
- .kotoba p {
- font-size: -80%;
- margin: 0;
- padding: 0;
- }
- }
「headに要素を追加」
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">