Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Date properties

  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    Date properties

    Hello

    The date appears on my page using the following:

    Code:
    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

    Code:
    span.show_date { 
        text-align: right; 
    }
    
    and
    
    span.show_date {
     font-family:"Times New Roman",Georgia,Serif;
     }
    Thanks

  • #2
    Regular Coder
    Join Date
    Aug 2011
    Location
    U.S.A.
    Posts
    233
    Thanks
    2
    Thanked 48 Times in 48 Posts
    <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.
    WordPress Designer and theme developer. KlongDesigns - helping bloggers and non-technical folks claim their space on the internet.

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello resdog

    Thanks for your reply.

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

    Code:
    <%@ 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.

  • #4
    Regular Coder
    Join Date
    Aug 2011
    Location
    U.S.A.
    Posts
    233
    Thanks
    2
    Thanked 48 Times in 48 Posts
    Change the <span> element to a <p> element:
    Code:
    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
    WordPress Designer and theme developer. KlongDesigns - helping bloggers and non-technical folks claim their space on the internet.

  • Users who have thanked resdog for this post:

    SteveH (10-28-2011)

  • #5
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    That's great resdog - just tried it and it works.

    Many thanks

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •