skip to Main Content

I want and I’m trying position the icon menu to her right edge to be equal to right edge of the image at the bottom. I don’t know why, but this icon won’t move :P. What’s wrong? How can I fix this? Here I am adding what does it look like:
enter image description here

I tried to add margin-left: auto on the icon-navigation class, display flex on a container. Then either flex grow on one child so it takes up as much space as possible. And I tried to add justify-content: space-between. But none of these ways doesn’t work. If it’s not working, there must be something wrong with the code structure (html or somewhere else a css property is overriding it), but I can’t find what is wrong.
This is my github: https://github.com/NatKacz99/news-homepage.
This is the live page: https://natkacz99.github.io/news-homepage/

2

Answers


  1. There is nothing wrong with your navigation css. On your defined screen width i.e 375px, the menu icon is set to the right of the navbar. Although the issue lies with your .container class. You have set some padding to it and it makes the total width of container exceed the actual width of viewport. This results in a horizontal scroll. Due to this scroll you are unable to visualize that your nav menu icon is actually at its right place.

    You can modify the CSS in style.css as follows, and you should be good to go.

    @media(max-width: 375px) {
    /*
    * Existing code
    */
    .container {
        /*Existing styling*/
        padding-inline: 0px;
    }
    

    PS You should get the out put as follows:
    enter image description here

    Login or Signup to reply.
  2. If Able to Comprehend your query Correctly you need to Position the ICON to the Right Side of the Screen,

    After Reviewing your Code I suggest this changes in CSS file,

    header {
        display: flex;
        justify-content: space-between; 
        align-items: center; 
        padding-left: 20px; 
        padding-right: 20px; 
        box-sizing: border-box;
    }
    
    .icon-navigation {
        position: absolute;
        top: 0;
        right: 0;
        padding: 10px;
    }
    

    Check this Output:

    Hope it Helps.
    [Output]: https://i.sstatic.net/WfrNTJwX.png

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search