Here's my initial attempt at coding a reddit-style comment using html and css. I have some inquiries about the css and overall structure:
- How can I align the comment body ("The King took off his hat...") with the comment head ("Nathan, posted...") and the comment tail ("reply permalink ...")? I experimented with adjusting the margin-bottom for .comment-left but it didn't resolve the issue.
- I may have gone overboard with the
tags. Which ones are unnecessary? - Is there a more efficient way to achieve the same layout?
Thank you all, Nathan
ps - I utilized helpful details from here to stack my voting arrows on top of each other.
https://i.sstatic.net/zTRrq.png
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>CSS sandbox: comments</title>
<style type="text/css">
.vote {
width: 15px;
float: left;
clear: left;
}
.vote img {
display: block;
float: none;
clear: both;
width: 15px;
}
.userpic img {
width: 60px;
}
.comment-contents li {
list-style-type: none;
margin-bottom: 10px;
}
.comment-left {
float: left;
}
.head {
margin-left:10px;
}
.tail-list li {
display: inline;
}
img {
border: 0;
}
a {
text-decoration: none;
}
</style>
</head>
<body>
<div class="comment">
<span class="comment-left">
<span class="vote">
<a href="#"><img alt="^" title="vote up" src="http://www.reddit.com/static/aupgray.gif"></a>
<a href="#"><img alt="v" title="vote down" src="http://www.reddit.com/static/adowngray.gif"></a>
</span>
<span class="userpic">
<a href="#">
<img src="http://www.gravatar.com/avatar/550deada0ac679dfc3c9103b674760af?s=128&d=identicon&r=PG" height="60" width="60">
</a>
</span>
</span>
<span class="comment-main">
<ul class="comment-contents">
<li class="head">
<a href="#">Nathan</a>, posted 2 hours ago
<a href="#" class="comment-collapse">[-]</a>
</li>
<li class="middle">
<p>The king took off his hat and looked at it. Instantly an immense
crowd gathered. The news spread like wildfire. From a dozen leading
dailies, reporters and cameramen came rushing to the scene pellmell in
highpowered monoplanes. Hundreds of reserves, responding without
hesitation to a riot call, displayed with amazing promptness quite
unparalleled inability to control the ever-increasing multitude, but
not before any number of unavoidable accidents had informally
occurred.</p>
<p>Chapter 1 - untitled (eecummings)</p>
</li>
<li class="tail">
<ul class="tail-list">
<li><a href="#">reply</a></li>
<li><a href="#">permalink</a></li>
<li><a href="#">offensive?</a></li>
</ul>
</li>
</ul>
</span>
</div>
</body>
</html>