Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • Winnie 40

    @Wineshuga

    Submitted

    This is my very first project here and I am happy I did it. I made use of CSS transform property for the first time to center the element. Sincerely, I do not really know why it had that effect. I'd be happy to get some helpful feedback on that. Thank You :)

    @JoseAngara

    Posted

    Hi, when you used left: 50% you moved #main-container 50% length of <body> to the right, so it is not centered because all #main-container is to the right of <body>.

    In order to solve that you used transform: translate(-50%, 0%), it moves #main-container 50% of its width to the right, so now half of it is to the left of <body> and half of it to the right of <body>

    To check more about the positioning properties check here: https://developer.mozilla.org/en-US/docs/Web/CSS/position For translate function check here: https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate

    Also, margin: 0 auto does not work in absolute positioned elements.

    Marked as helpful

    0
  • @Dhei-vid

    Submitted

    ◦ Positioning the elements at the center was a bit tasking. ◦ I am not sure I got the positioning spot on. ◦ Is there a better way to position elements?

    @JoseAngara

    Posted

    Hi, to align elements you can use Flexbox, in this case you can use

    body {
      display: flex;
      flex-direction: column;
      align- items: center;
      justify-content: center;
    }
    

    Of couse, there are more ways to do this, like using Grid, flex containers or transformations.

    1
  • @JoseAngara

    Posted

    Hi, I used the after psedo-element for that purpose. This is my code:

     ​.​text-container__link​::​after​ { 
     ​  ​content​:​ ​""​; 
     ​  ​position​:​ absolute; 
     ​  ​height​:​ ​10​px​; 
     ​  ​width​:​ ​100​%​; 
     ​  ​border-radius​:​ ​5​px​; 
     ​  ​bottom​:​ ​-2​px​; 
     ​  ​left​:​ ​0​px​; 
     ​  ​z-index​:​ ​-1​; 
     ​  ​opacity​:​ ​0.25​; 
     ​  ​transition​:​ opacity ​0.25​s​ ease-in; 
     ​} 
     ​.​text-container__link​:​hover​::​after​ { 
     ​  ​opacity​:​ ​1​; 
     ​}
    

    I put the background color in a modifier.

    Marked as helpful

    1