public class BlogComment
{
public int ID;
public int UserID;
public string Username;
public string Comment;
public DateTime Date;
public int VotesUp;
public int VotesDown;
public Panel GetCommentPanel()
{
Panel WrapPanel = new Panel();
WrapPanel.CssClass = "user-comment-wrapper";
Panel VotePanel = new Panel();
VotePanel.CssClass = "rfloat";
HyperLink UpVote = new HyperLink();
HyperLink DownVote = new HyperLink();
UpVote.CssClass = "s vote-box vote-up";
DownVote.CssClass = "s vote-box vote-down";
UpVote.NavigateUrl="#";
DownVote.NavigateUrl = "#";
VotePanel.Controls.Add(UpVote);
VotePanel.Controls.Add(DownVote);
WrapPanel.Controls.Add(VotePanel);
Panel UserTextPanel = new Panel();
UserTextPanel.CssClass = "user-comment-txt";
Literal UserText = new Literal();
UserText.Text = this.Comment;
UserTextPanel.Controls.Add(UserText);
return WrapPanel;
}
试图生成以下HTML:觉得我做错了生成HTML
<div class="user-comment-wrapper">
<div style="float:right">
<a class="s vote-box vote-up" href="#"></a>
<a class="s vote-box vote-down" href="#"></a>
</div>
<div class="user-comment-txt">
Object comes with instantiated Department with empty atributes Object comes with instantiated Department with empty atributes Object comes with instantiated Department with empty atributes.Department with empty atributes Object comes with instantiated Department with empty atributes Object comes with instantiated Department with empty atributes.
</div>
<div class="comment-info-wrapper">
<div style="float:left">
<strong>Posted by <a href="#">Tom</a></strong>
</div>
<div style="float:right">
<strong><abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr></strong>
</div>
<div class="clear"></div>
</div>
</div>
我的意思是它的工作原理,但我不禁觉得这个设计很烂。
除了编写自己的博客引擎外,还有其他的风格属性(比如编写自己的博客引擎 - 那么多),而不是通过CSS控制UI? – kd7 2011-03-06 22:58:47
@ kd7,只是因为它需要的唯一样式属性是float:left或float:right这是我设计的唯一异常。 – 2011-03-06 22:59:41
你为什么觉得这很糟糕? – 2011-03-06 23:04:58