Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't move buttons to the right side

I have problem where I can’t move objects in div (buttons in this case) to one side.

I have this HTML:

      <div class='post-div'>
        <h1>There will be title</h1>
        <div class='post-content-and-actions'>
          <div class='peace-of-content'>
            <p>Here will be a little bit of content and Lorem ipsum</p>
          </div>
          <div class='actions'>
            <button class='edit'>EDIT</button>
            <button class='edit delete'>DELETE</button>
          </div>
        </div>
      </div>

And css:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.post-div {
  width: 1000px;
  height: 150px;
  padding: 8px;
  .post-content-and-actions {
    width: 100%;
    display: flex;
    .peace-of-content {
      width: 700px;
    }
    .actions {
      width: 300px;
      .edit {
        width: 100px;
        height: 30px;
        font-size: 15px;
        background-color: green;
        &.delete {
          background-color: red;
        }
      }
    }
  }
}

In actions section I want to move all buttons to the right and whatever I do, I just can’t. float: right, right: 0 etc. Actually, I have no idea why!

>Solution :

You could add text-align: right; to .actions :

    ...
    .actions {
      width: 300px;
      text-align: right;
      ...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading