View Full Version : Date properties

10-28-2011, 08:42 AM

The date appears on my page using the following:

span.show_date {
font-size: x-small;
span.show_date sup {
font-size: xx-small;

In order to right-align the date, would I use: text-align: right; and if I wanted to change the font-family color, size, etc of the date would I just group everything under span.show_date, as in

span.show_date {
text-align: right;


span.show_date {
font-family:"Times New Roman",Georgia,Serif;


10-28-2011, 03:24 PM
<span> is an inline element, so you can't just make it right aligned. You would need a block level container in order to align text, like a <p> or a <div> tag.

In theory, what you're saying is correct (for changing the font), but your css shows a <sup> tag inside the show_date span, so in regards to specificity, the font-size: xx-small will be applied to the text inside the <sup> tag.

In order to give you a more precise answer, we would need to see the actual HTML code to see how the entities are laid out.

10-28-2011, 04:19 PM
Hello resdog

Thanks for your reply.

This is all I have at the moment in my main (index.asp page):

<%@ Language="VBScript" %>

Dim suffix
Select Case Day(Date())
Case 1,21,31: suffix = "st"
Case 2,22: suffix = "nd"
Case 3,23: suffix = "rd"
Case Else: suffix = "th"
End Select
Response.Write "<span class=""show_date"">" & WeekdayName(Weekday(Date())) _
& " " & Day(Date()) & "<sup>" & suffix & "</sup> " _
& MonthName(Month(Date())) & "</span>"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<LINK REL=StyleSheet HREF="index.css" TYPE="text/css" MEDIA=screen>



Further advise would be appreciated.

10-28-2011, 05:05 PM
Change the <span> element to a <p> element:

Response.Write "<p class=""show_date"">" & WeekdayName(Weekday(Date())) _
& " " & Day(Date()) & "<sup>" & suffix & "</sup> " _
& MonthName(Month(Date())) & "</p>"

and then you can right align the text using p.showdate

10-28-2011, 05:46 PM
That's great resdog - just tried it and it works.

Many thanks