Make a list start from same margin

Tell us what’s happening:

I am making a timeline in a tribute page. I centered the list but it looks scattered all over the place. So, how do I center a list and make all the lists start from the same margin?

Your code so far

        <head>
  <style>
    ul{
      
      text-align:center;
      list-style-position:inside;
      
    }
    h2{
      font-size:20px;
    }
    .first-class{
    text-align:center;
    }
    div{
      font-size: 17px;
    }
  </style>
</head>
<main id="main">
   <h1 id="title" class="first-class"> A tribute to Dr. Norman Borlaug<h2>
    <div id="img-div">
      <figure>
        <img src="https://cdn.britannica.com/50/136250-050-E1680FC7/Norman-Borlaug-1970.jpg" width="1150" height="900" alt="Young Dr. Norman Borlaug holding wheat plant on a wheat field ">
          <figcaption class="first-class">The man who saved a billion lives.</figcaption>
      </figure>
    </div>
     
     <h2 class="first-class">Here's a timeline of Dr. Borlaug's life:</h2>
       <p >
         <ul >
           <li ><b>1914</b> - Born in Cresco Lowa</li>
           <li><b>1933</b> - Leaves his family's farm to attend the University of Minnesota, thanks to a Depression era program known as the "National Youth Administration"</li>
           <li><b>1935</b> - Has to stop school and save up more money. Works in the Civilian Conservation Corps, helping starving Americans. "I saw how food changed them", he said. "All of this left scars on me."</li>
           <li><b>1937</b> - Finishes university and takes a job in the US Forestry Service
</li>
           <li><b>1938</b> Marries wife of 69 years Margret Gibson. Gets laid off due to budget cuts. Inspired by Elvin Charles Stakman, he returns to school study under Stakman, who teaches him about breeding pest-resistent plants.</li>
           <li><b>1941</b> - Tries to enroll in the military after the Pearl Harbor attack, but is rejected. Instead, the military asked his lab to work on waterproof glue, DDT to control malaria, disinfectants, and other applied science.</li>
           <li><b>1942</b>- Receives a Ph.D. in Genetics and Plant Pathology</li>
           <li><b>1944</b>- Rejects a 100% salary increase from Dupont, leaves behind his pregnant wife, and flies to Mexico to head a new plant pathology program. Over the next 16 years, his team breeds 6,000 different strains of disease resistent wheat - including different varieties for each major climate on Earth.</li>
           <li><b>1945</b> - Discovers a way to grown wheat twice each season, doubling wheat</li>
           <li><b>1953</b> - crosses a short, sturdy dwarf breed of wheat with a high-yeidling American breed, creating a strain that responds well to fertilizer. It goes on to provide 95% of Mexico's wheat.</li>
           <li><b>1962</b>- Visits Delhi and brings his high-yielding strains of wheat to the Indian subcontinent in time to help mitigate mass starvation due to a rapidly expanding population</li>
           <li><b>1970</b>- receives the Nobel Peace Prize</li>
           <li><b>1983</b>- helps seven African countries dramatically increase their maize and sorghum yields</li>
           <li><b>1984</b> - becomes a distinguished professor at Texas A&M University</li>
           <li><b>2005</b>- states "we will have to double the world food supply by 2050." Argues that genetically modified crops are the only way we can meet the demand, as we run out of arable land. Says that GM crops are not inherently dangerous because "we've been genetically modifying plants and animals for a long time. Long before we called it science, people were selecting the best breeds."</li>
           <li><b>2009</b> - dies at the age of 95.</li>
          
       </ul>
       </p>
    </>
  </main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Build a Tribute Page

Link to the challenge:

It looks like maybe you tried four different ways to include your code in the question. It would be good to look up how to use the editor. You haven’t put it online like the exercise instructs which makes it easier for people to help you.

What I can see is that the birthplace is wrong and the list item for 1937 isn’t closed and you end with an empty tag.

By using text-align you did align everything to a common margin. Just not what you had in mind. Normally the list item decoration is vertically aligned. You can move the entire list with left margin on the ul.

By using the Chrome developer tools one can see that Chrome adds 40px of left margin to lists.

Up to you how you want to draw the line.
HTH

Hey there,

good work so far! :slightly_smiling_face:

I’ve edited your post for readability. When you enter a code block into a post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor ( </> ) to add backticks around text.

See this post to find the backtick on your keyboard. Backticks (`) are not single quotes (’).

Please use a service like codepen to show us your whole project and add the link of the project to your first post :slightly_smiling_face: