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

How to move the after element down so that it is even with the parent?

I have this snippet of code: a header that I have added four dots to using the "after" property.

.mastermega h1 {
    font-family: 'MagicRetro';
    color: #353935;
    font-size: 36px;
    margin-left: 5px;
}
.mastermega h1:after {
    position: relative;
    content: "• • • •";
    font-size: 75px;
    color: rgba(246, 139, 187, 0.8);
    margin-left: 30px;
} 

How do I force the dots down so that they’re even with the header text?

Header text with incorrectly placed dots

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

I have tried using "margin-top" but it doesn’t seem to do anything.

>Solution :

You can use display: flex and align-items: center to make it align with h1.

h1 {
  color: #353935;
  font-size: 36px;
  margin-left: 5px;
  display: flex;
  align-items: center;
}

h1:after {
  content: "• • • •";
  font-size: 75px;
  color: rgba(246, 139, 187, 0.8);
  margin-left: 30px;
  margin-top: 10px;
}
<h1>Family</h1>
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