HiveBrain v1.2.0
Get Started
← Back to all entries
patternhtmlModerate

Testimonial section with HTML tags

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
testimonialsectionwithtagshtml

Problem

I created this testimonial on CodePen

I am a bit skeptical about a few things in my HTML structure. For example, I typically see testimonials enclosed in `s with custom classes. In my case I used a but had to overwrite a lot of rules.

Also wondering if enclosing the author in
` tags was wise.

HTML


  
    “Such cool. Much awesome. WOW”
  
  
    – 
    Doge, 
    The Moon
  


CSS

/* == resets == */
body { margin: 0; padding: 0; }
/* == project == */
body { 
  background: none repeat scroll 0% 0% rgb(240, 240, 240);
  color: rgb(102, 102, 102);
  font-family: "Helvetica Neue", Helvetica, Arial, Sans-serif;
  font-size: 22px;
}
.wrapper {
  width: 600px;
  margin: 24px auto;
}

blockquote {
  background-color: rgb(255, 255, 255);
  border-radius: 6px;
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 1.4;
  margin: 0;
  padding: 17px;
}
p.author {
  background-color: transparent;
  font-weight: 500;
  font-size: 22px;
  line-height:22px;
  margin: 24px 0 0 18px;
}
strong {
  color: rgb(68, 68, 68);
}

a {
  color: rgb(64, 131, 169);
  text-decoration: none;
}

Solution

-
I would say that for it to be semantically accurate, the author should be a part of the blockquote, perhaps using a footer.

-
You should include a cite attribute if the quote has a source.

-
The quote content should be inside a paragraph element.

-
I guess now you don't need the wrapper any more.


    “Such cool. Much awesome. WOW”

     
       – 
       Doge, 
       The Moon
     
   


-
To make it look the same I had to change these bits of CSS:

blockquote {
  font-size: 22px;
  margin: 0;
}

blockquote p {
  background-color: rgb(255, 255, 255);
  border-radius: 6px;
  font-family: Georgia, serif;
  line-height: 1.4;
  padding: 17px;
}

footer.author {
  background-color: transparent;
  font-weight: 500;
  font-size: 22px;
  line-height:22px;
  margin: 24px 0 0 18px;
}


-
Here's the result.

Code Snippets

<blockquote cite="http://knowyourmeme.com/memes/doge">
    <p>&ldquo;Such cool. Much awesome. WOW&rdquo;</p>

     <footer class="author">
       &ndash; 
       <strong>Doge</strong>, 
       <a href="#">The Moon</a>
     </footer>
   </blockquote>
blockquote {
  font-size: 22px;
  margin: 0;
}

blockquote p {
  background-color: rgb(255, 255, 255);
  border-radius: 6px;
  font-family: Georgia, serif;
  line-height: 1.4;
  padding: 17px;
}

footer.author {
  background-color: transparent;
  font-weight: 500;
  font-size: 22px;
  line-height:22px;
  margin: 24px 0 0 18px;
}

Context

StackExchange Code Review Q#41017, answer score: 13

Revisions (0)

No revisions yet.