0

I need to get a speech bubble that looks something like this via CSS:

I do not need to set default height for a box. It must have dynamic height. And if the height is increased, the left arrow must be in the center.

I looked through some examples, but I don't know how to change the height! Here is the code I have:

<style>
    .bubble
    {
    position: relative;
    width: 250px;
    height: 120px;
    padding: 0px;
    background: gray;
    margin-left:50px;
    }

    .bubble:after
    {
    content: "";
    position: absolute;
    top: 45px;
    left: -15px;
    border-style: solid;
    border-width: 15px 15px 15px 0;
    border-color: transparent gray;
    display: block;
    width: 0;
    z-index: 1;
    }
</style>
<div class="bubble"></div>
0

1 Answer 1

1

Here is JSBin

Make

 top: 40%;
 bottom: 50%;

in your .bubble:after in CSS script

You have to check it by changing the .bubble height

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.