[英]How do I add the date a blog post was created in place of a bullet point under list-style-type?
Hey I am learning how to create a basic webpage using HTML5 & CSS and I was wondering how I could add the date eg "23 Oct 2013" before each blog post link in place of where the bullet point would be when using list-style-type in CSS. 嘿,我正在学习如何使用HTML5和CSS创建基本网页,我想知道如何在每个博客文章链接之前添加日期(例如“ 2013年10月23日”),以代替使用列表样式时的要点:输入CSS。 For example:
例如:
23 Oct 2013 » How to code in HTML 2013年10月23日»如何用HTML编码
Would be an example of how it would look like in a browser, bearing in mind that it is a list? 记住它是一个列表,这将是一个示例,说明它在浏览器中的外观如何?
Thanks 谢谢
To be a true working blog, the other answers would have you dynamically create css and have a class or id for each date you wanted displayed. 要成为一个真正的工作博客,其他答案将让您动态创建CSS并为要显示的每个日期提供一个类或ID。 It would be better to set
list-style-type: none
and have your back-end load the dates and post titles, not have it write your css. 最好设置
list-style-type: none
,让后端加载日期和帖子标题,而不是让它编写CSS。
HTML/PSEUDOCODE: HTML /伪代码:
<ul id="blog">
{% for post in blog %}
<li class="post">{{ post.date }} » {{ post.title }}</li>
{% end for %}
</ul>
CSS: CSS:
#blog {
list-style-type: none
}
This way it would look like: 这样,它看起来像:
23 Oct 2013 » How to code in CSS
2013年10月23日»如何使用CSS编码
19 Oct 2013 » How to code in HTML
2013年10月19日»如何用HTML编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.