I cant align the text? Im probably missing something stupid but cant figure out why

Ive never used this forum before so sorry if im doing something wrong but im currently creating an online shop for a local business. I want to align the title into the middle of the div but it just doesnt want to work for me.
My HTML for each product (in unordered list):

  • < a href='#' class='image'> < a href='#' class='name'>Product Name
    Product Price
    < a href='#' class='buy'>Add to Cart
  • My CSS here:
    .item{
    height:300px;
    margin: 5px;
    background-color: #ffffff;
    }
    .item img{
    height: 200px;
    border-style: solid;
    border-color: black;
    margin: 10px 17px;
    }
    .name {
    text-decoration: none;
    color: black;
    font-weight:bold;
    background-color: #ffffff;
    text-align: center;
    }

    Everything works in the .name tag including editing the font weight and color but the text will not move, with indent or aligning it.

    Thanks for any help

    Can you share a demo via codepen?

    1 Like


    here you are x

    Give your .products li

    text-align: center;

    1 Like

    center>
    a href=’#’ class=β€˜name’>Product Name/a>
    /center>
    Add the center tag before the attribute of a and close it . i
    I find the solution its mostly like that .in the css its not work but in the html u can do that.

    1 Like