SuperSimpleDev / html-css-course-2022

1.32k stars 993 forks source link

10b button div position #12

Open Naleks-ph opened 2 years ago

Naleks-ph commented 2 years ago

Hello!

I could reproduce the homework until coming to the div button part. At first, I've set a margin right for the text div. It made my buttons not being aligned on the right side because of the different size of text in each box.

I've set padding and removed the margin but it only made the buttons get closer to the text.

After searching for solutions I could find the following one: float: right; It made the button div go to the right side respecting the padding. But now it isn't centered (I've tried using vertical align and align-items without much success...):

image

Here is the main css:

.text{ font-family: arial; display: inline-block;

} div{ vertical-align: middle; display: inline-block;

} .together{ display: block; height: 60px; width: 320px; padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px; border-radius: 15px; border: none; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25); margin-right: 10px;

} p{ margin-top: 0px; margin-bottom: 3px; font-size: 14px; } .name{ font-weight: bold; }

.follow{ color: white; background-color: rgb(24, 119, 242); border:none; width: 70px; height: 28px; border-radius: 5px;
} .who, .what{ color: rgb(96, 96, 96); }

.follow:hover{ cursor: pointer; }

.button{ float: right;
align-items: center; }

Naleks-ph commented 2 years ago

I could center it with padding-top:16px but isn't there an other way of doing it?

Abdulhamidsalisu commented 1 year ago

Hi πŸ‘‹ For your button, Why don't you use padding instead of height and width 😊