0

I am trying to create a list of images having text just below it. All images in this list should be horizontal. I am using this fiddle It is working fine without react.
But I want to do it in react as follows.

 a.subList.map((b) => (
                                    <figure id="figure">
                                        <ul>
                                            <li>
                                                <img src={b.imageUrl} />
                                                    <figcaption>{b.name}</figcaption>
                                            </li>
                                        </ul>

                                    </figure>
                                ))

where a.subList is in this form

[{"imageUrl":"/acb","name":"cvb"},{"imageUrl":"/asdf","name":"cvbnm"}]

But using react function it is not showing in horizontal direction.

1 Answer 1

11

It's actually a styling issue, Here is the working fiddle. I chose flexbox to display the items horizontally, but you can choose something else.

 <div class="topContainer">

 </div>

and add the following css.

.topContainer{
  display: flex;
  flex-direction: row;
}

Note about browser support: It's actually safe to use it. (97% support worldwide)

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.