Day # 30: Custom Blockquote



I am a collector of quotes. I have already told you that I am an avid reader, so I guess I must be always on the lookout for quotes that inspire me, both in my personal and professional lives.

I was looking for innovative ways to style quotes and I ran into this article from CSS Tricks, in which they propose to style the quote by using the HTML element blockquote (which I wasn’t aware of) and styling it through pseudo elements before and after.


To place the opening and closing quotes, we just set their location like this:

blockquote::before {

  content: open-quote;

  /* Place it at the top-left */

  top: 0;

  left: 0;

}


blockquote::after {

  content: close-quote;

  /* Place it at thee bottom-right */

  bottom: 0;

  right: 0;

}


And finally, to polish the final outcome, we must add a few extra details selecting both pseudo elements at the same time: 


blockquote::before,

blockquote::after {

  background-color: #fff;

  display: block;

  width: 60px;

  height: 60px;

  line-height: 1.618;

  font-size: 3em;

  border-radius: 100%;

  text-align: center;

  position: absolute;

}


Comments

Popular posts from this blog

Day # 19: Checkbox animation

Day # 12: Typewriter Effect

Day # 53: Icon text