"PorkyJr" <no****@nospam.net> wrote in message
news:uQ**************@TK2MSFTNGP11.phx.gbl...
Running an asp page that has the following code:
<%
response.Write MonthName(Month(date))
%>
<%
response.Write Day(date)
%>
,
<%
response.Write Year(date)
%>
I would like to modify the font size & face to be something other than
the "default" of Times New Roman. How can I do this?
Ideally, you would apply your format via a stylesheet (CSS), and you would
wrap your output above in some sort of logical container (perhaps a span
with a class applied to it, if this isn't already represented by an element
in HTML). I'm going to assume you are new to CSS, so I'm not going to
discuss including an external stylesheet (though that is the preferred
method). However, you could put the styles in the head of your (X)HTML
document like so:
<head>
<title>My Title</title>
<style type="text/css">
..todayDate
{
font-family: arial,sans-serif;
font-size: 125%;
}
</style>
</head>
The above code will cause the items in your (X)HTML that have
class="todayDate" to use arial font (or the default sans-serif font if arial
is not available) and to be 25% larger than the text in the parent
container. This really isn't the place to go into this, though, so I'm
going to refer you to the CSS specs. It's a good resource to reference:
http://www.w3.org/Style/CSS/#specs
Also, your code is somewhat inefficient and harder to read because you
switch between ASP and HTML without a real need. If you are going to do
that, you should consider using the shorthand version of Response.Write,
which is <%= %>. Some cleaner examples below:
<span class="todayDate">
<%
Response.Write MonthName(Month(date))
Response.Write " "
Response.Write Day(date)
Response.Write ", "
Response.Write Year(date)
%>
</span>
or
<span class="todayDate">
<%=MonthName(Month(date))%> <%=Day(date)%>, <%=Year(date)%>
</span>
Hope this helps.
Regards,
Peter Foti