JSFiddle - React, Tailwind, and code Playground

by jdmiller82

HTML

<div class="parent">
    <ul>
        <li>
            <span class="open-close">+</span>
            <div class="article">
                <h2>Header</h2>
                <div class="content">
                    <p>Chupa chups cotton candy jelly caramels. Powder powder faworki bear claw jelly beans. Bonbon carrot cake liquorice macaroon carrot cake tiramisu halvah. Tootsie roll cake cheesecake jujubes icing cake.</p>
                </div>
            </div>
        </li>
        
        <li>
            <span class="open-close">+</span>
            <div class="article">
                <h2>Header</h2>
                <div class="content">
                    <p>Chupa chups cotton candy jelly caramels. Powder powder faworki bear claw jelly beans. Bonbon carrot cake liquorice macaroon carrot cake tiramisu halvah. Tootsie roll cake cheesecake jujubes icing cake.</p>
                </div>
            </div>
        </li>
        
        <li>
            <span class="open-close">+</span>
            <div class="article">
                <h2>Header</h2>
                <div class="content">
                    <p>Chupa chups cotton candy jelly caramels. Powder powder faworki bear claw jelly beans. Bonbon carrot cake liquorice macaroon carrot cake tiramisu halvah. Tootsie roll cake cheesecake jujubes icing cake.</p>
                </div>
            </div>
        </li>
    </ul>
</div>

CSS

.parent {
margin:50px;
}

.parent ul {
    display: block;
    margin: 0 auto;
    padding: 0;
    width: 350px;
}

.parent ul li {
    position: relative;
    margin: 10px;
    width: 0px;
    min-height: 35px;
}

.parent ul li .open-close {
    position: absolute;
    top: 0;
    left: -36px;
    display: block;
    margin: 0;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background: #0088ff;
    border: 1px solid #0088ff;
    border-radius: 5px;
    font-size: 28px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

.parent ul li .article {
    display: block;
    margin: 0;
    padding: 0;
    min-height: 35px;
    border: 1px solid #0088ff;
}

.parent ul li .article h2 {
    display: none;
    margin: 0;
    padding: 10px;
    height: 15px;
    line-height: 15px;
}

.parent ul li .article .content {
    display: none;
}