-1

I have this simple template:

<div className="wrapper">
      <div className="block one">
        <GoSearch />
        15
      </div>
      <div className="block two">test</div>
    </div>

with this css:

.wrapper {
  display: flex;
  width: 100%;
  margin-top: 40px;
  justify-content: center;
  align-items: center;
}

.block {
  flex: 1;
  background-color: red;
}

looking like this:

enter image description here

Why is the icon not centered vertically? I also tried with vertical-align: middle directly to the svg

2 Answers 2

0

Add flex-direction: column; as the default value for this property is row.

1
  • to .wrapper? I don't need that. Both divs should be in the same row
    – Dani
    Commented Jul 10 at 8:16
0

.one also needs this style:

display: inline-flex;
align-items: center;

Not the answer you're looking for? Browse other questions tagged or ask your own question.