1

My a tag with the class name of read-more is inside a Div called article text, somehow the margin top does not work, why does that happen?

When I inspected it, there seems to me a margin-top but it seems like the A tag is out of the flow of the html

Here is a link to my codepen :https://codepen.io/jerico001/pen/MWppMdG

CSS

#Article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 5rem 10rem 5rem;
}

.article-cards-wrapper {
  display: flex;
  justify-content: space-evenly;
  margin-top: -3rem;
  width: 100%;
}

.article-container {
  width: 150rem;
  height: 75rem;
  padding: 4.7rem;
  box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.4);
  border-radius: 0.5rem;
  margin: 0.5rem;
}

.article-head h1 {
  font-family: "Mulish", sans-serif;
  font-size: 3.8rem;
  font-weight: 300;
  color: #00c3f4;
}

.article-head p {
  font-family: "Mulish", sans-serif;
  font-size: 2.8rem;
}

.article-body {
  display: flex;
  height: 19.3rem;
  margin-top: 3.5rem;
}

.article-body img {
  height: 19.3rem;
  width: 86.3rem;
  background-color : lightblue;
  object-fit: cover;
}

.article-text {
  height: 19.3rem;
  margin-left: 3.1rem;
}

.article-body p {
  font-family: "Mulish", sans-serif;
  font-size: 2.3rem;
}

.read-more {
  color: #00c3f4;
  font-family: "Mulish", sans-serif;
  font-size: 2.5rem;
  font-weight: 500;
  margin-top: 100rem;
}

1 Answers1

1

Add display: inline-block; style to the <a> tag. Vertical margin does not work with inline elements.

ref: SO comment

deekeh
  • 675
  • 1
  • 6
  • 21