...

View Full Version : Date properties



SteveH
10-28-2011, 07:42 AM
Hello

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;
}

and

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

Thanks

resdog
10-28-2011, 02: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.

SteveH
10-28-2011, 03: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">
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>mySite</title>

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

<body>

</body>
</html>

Further advise would be appreciated.

resdog
10-28-2011, 04: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

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

Many thanks

Steve



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum