Home > Mobile >  CSS Flexbox Not Centering Vertically
CSS Flexbox Not Centering Vertically

Time:08-08

I am trying to make a responsive layout using flexbox. When it is wide, I want there to be two columns, one row. I want the content in the second column to be centered vertically, but not horizontally. When the window is narrow (like on a mobile device), I want column two to wrap underneath column one.

Here is my code.

#intro-grid {
  display: flex;
  width: 100%;
  height: 100%;
  max-width: 1000px;
  margin: 0 auto;
  margin-bottom: 6rem;
}

.row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
}

.column {
  display: flex;
  flex-direction: column;
  flex-basis: 100%;
  flex: 1;
}

.jesse-pic {
  display: block;
  max-width: 400px;
  border-radius: 50%;
}

.intro-list {
  display: flex;
  color: var(--main-purple);
  margin: auto;
  padding: 5px 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 50%;
}
<div id="intro-grid">
  <div >
    <div >
      <img  src="https://heathology.github.io/img/Jesse-Heath-July-2022.jpg" alt="Jesse Heath">
    </div>
    <div >
      <ul>
        <li >I am a web developer</li>
        <li >           
  • Related