Need help with the last step of tribute page.How do I align the image in the web page to the center?

<html lang="en">
        /* Styling the body element 
        like body color and margin */
        body {
            background-color: #F5FFFA;
            margin: 20%;
        /* Styling the Title and giving 
        shadow to the title */
        #title {
            text-align: center;
            text-shadow: 5px 5px 10px grey;
            font-size: 20vh;
        /* Setting width and display 
        type of image */
            display: block;
           text-align: center;
            max-width: 100%;
        /* Setting font color and font 
        size of the image-caption */
        #img-caption {
            font-size: 17px;
            font-family: Gill Sans;
            color: black;
        /* Styling the content of the page with-
        padding, font-size, etc.*/
        div#tribute-info {
            background-color: rgb(46, 139, 87, 0.25);
            box-shadow: 20px 20px 20px #98FB98;
            font-family: Georgia;
            padding: 25px 25px;
            margin: 11px;
            margin-top: 50px;
        /* Styling the title of the content */
        h1.title-Michelle {
            font-size: 35px;
            color: red;
            text-align: center;
            text-shadow: 5px 5px 10px pink;
        /* Styling the link provided at the end */
        #tribute-link {
            text-decoration: none;
            color: black;
    <main id="main">
        <!-- Title of the page -->
        <h1 id="title">
            Michelle Obama
        <div id="img-div">
            <!--Image of the Tribute Person-->
            <img src="" id="image" 
                alt="Error Loading Image">
            <small id="img-caption">
                The First Lady of USA
        <div id="tribute-info">
            <!--Achievements and other 
                details of the person-->
            <h1 class="title-Michelle">
                The Lady of Great Times
                ☛ Michelle LaVaughn Robinson Obama (born January 17, 1964) is an American attorney and author who served as the First Lady of the United States from 2009 to 2017. She was the first African-American woman to serve in this position. She is married to the 44th President of the United States, Barack Obama.
              <br><br>☛ Raised on the South Side of Chicago, Illinois, Obama is a graduate of Princeton University and Harvard Law School. In her early legal career, she worked at the law firm Sidley Austin where she met Barack Obama. She subsequently worked in nonprofits and as the associate dean of Student Services at the University of Chicago as well as the vice president for Community and External Affairs of the University of Chicago Medical Center. Michelle married Barack in 1992, and together they have two daughters.
              <br><br> ☛ Robinson was inspired to follow her brother to Princeton University, which she entered in 1981. She majored in sociology and minored in African-American studies, graduating cum laude with a Bachelor of Arts in 1985 after completing a 99-page senior thesis titled "Princeton Educated Blacks and the Black Community" under the supervision of Walter Wallace.
              <br><br> ☛ Robinson pursued professional study, earning her Juris Doctor (J.D.) degree from Harvard Law School in 1988. By the time she applied for Harvard Law, biographer Bond wrote, her confidence had increased: "This time around, there was no doubt in her mind that she had earned her place". Her faculty mentor at Harvard Law was Charles Ogletree, who has said she had answered the question that had plagued her throughout Princeton by the time she arrived at Harvard Law: whether she would remain the product of her parents or keep the identity she had acquired at Princeton; she had concluded she could be "both brilliant and black".
              <br><br> ☛ At Harvard, Robinson participated in demonstrations advocating the hiring of professors who were members of minority groups. She worked for the Harvard Legal Aid Bureau, assisting low-income tenants with housing cases. She is the third first lady with a postgraduate degree, after her two immediate predecessors, Hillary Clinton and Laura Bush. She later said her education gave her opportunities beyond what she had ever imagined.
              <br><br> ☛ Michelle's mother Marian Robinson, was a stay-at-home mom.Her father was Fraser C. Robinson III, who worked at the city's water purification plant.Robinson's father, Fraser, died from complications from his illness in March 1991.She would later say that although he was the "hole in my heart" and "loss in my scar", the memory of her father has motivated her each day since. Her friend Suzanne Alele died from cancer around this time as well. These losses made her think of her contributions toward society and how well she was influencing the world from her law firm, in her first job after law school. She considered this a turning point.
              <br><br> ☛Following law school, Obama became an associate at the Chicago office of the law firm Sidley & Austin, where she met her future husband Barack. At the firm, she worked on marketing and intellectual property law. She continues to hold her law license, but as she no longer needs it for her work, she has kept it on a voluntary inactive status since 1993.
In 1991, she held public sector positions in the Chicago city government as an Assistant to the Mayor, and as Assistant Commissioner of Planning and Development. In 1993, she became Executive Director for the Chicago office of Public Allies, a non-profit organization encouraging young people to work on social issues in nonprofit groups and government agencies. She worked there nearly four years and set fundraising records for the organization that still stood twelve years after she had left. Obama later said she had never been happier in her life prior to working "to build Public Allies".

In 1996, Obama served as the Associate Dean of Student Services at the University of Chicago, where she developed the University's Community Service Center. In 2002, she began working for the University of Chicago Hospitals, first as executive director for community affairs and, beginning May 2005, as Vice President for Community and External Affairs.
She continued to hold the University of Chicago Hospitals position during the primary campaign of 2008, but cut back to part-time in order to spend time with her daughters as well as work for her husband's election.She subsequently took a leave of absence from her job.
According to the couple's 2006 income tax return, her salary was $273,618 from the University of Chicago Hospitals, while her husband had a salary of $157,082 from the United States Senate. The Obamas' total income was $991,296, which included $51,200 she earned as a member of the board of directors of TreeHouse Foods, and investments and royalties from his books.
Obama served as a salaried board member of TreeHouse Foods, Inc. (NYSE: THS), a major Wal-Mart supplier from shortly after her husband was seated in the Senate until she cut ties shortly after her husband announced his candidacy for the presidency; he criticized Wal-Mart labor policies at an AFL-CIO forum in Trenton, New Jersey, on May 14, 2007. She also served on the board of directors of the Chicago Council on Global Affairs.

In 2021, the former first lady announced that she has been "moving toward retirement".Though she continues to be active in political campaigns, the former first lady has said she is reducing the amount of work to spend more time with her husband.
              <br><br> ☛During her early months as First Lady, Obama visited homeless shelters and soup kitchens. She also sent representatives to schools and advocated public service.
            For more information, 
        check out
        <a id="tribute-link" target= "_blank" href="">
            <b>Michelle Obama</b> on Wikipedia. [
            <small>Developed by @<a href="#">
                    Akshita Koul.</a></a>

Hi there,
if you want to align an image to the center you can use margin: auto; . However, this depends on the parent element.
Another way you can do this img { display: block; margin-left: auto; margin-right: auto;

Hey! Additionally
you can try going through this lesson if you want to learn more about it.

Hope this helped! :smiley:

Hi, thanks a lot for the great help!! I got it.

Hi, thank you for the kind suggestion. I will surely do try other possible ways too by again referring the content! :grinning:

haan haan koi ni! if you need help with anything else let me know! :smiley:

thanks surely i will!! :+1: :+1:

I’ve edited your post for readability. When you enter a code block into a forum 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.
Note: Backticks (`) are not single quotes (’).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.