471,853 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

Response.Write font size & face



Running an asp page that has the following code:

<%
response.Write MonthName(Month(date))
%>
&nbsp;
<%
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?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
3 16089
<%
Dim strDate
Dim strFont
strDate = Date()
strFont = "<font style=""font-size: 12px; color: #ff0000; font-family:
verdana"">"

Response.write strFont & strDate

%>

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
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))
%>
&nbsp;
<%
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?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
PorkyJr wrote:
Running an asp page that has the following code:

<%
response.Write MonthName(Month(date)) <snip> %>

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?


Do you want to change it for the entire page? If so, use the body tag's
style attribute (or css).

If you want to only affect this piece of text, then wrap it in a span:

<span style="font-family:sans-serif">
<%
response.write ...
....
%>
</span>

This is not really an asp question, so any follow-ups should go to a css or
html newsgroup.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
"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))
%>
&nbsp;
<%
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 "&nbsp;"
Response.Write Day(date)
Response.Write ", "
Response.Write Year(date)
%>
</span>

or

<span class="todayDate">
<%=MonthName(Month(date))%>&nbsp;<%=Day(date)%>, <%=Year(date)%>
</span>

Hope this helps.
Regards,
Peter Foti
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mark Sargent | last post: by
2 posts views Thread by Rob McLennan - ZETLAND | last post: by
14 posts views Thread by Hugh Welford | last post: by
24 posts views Thread by Harris Kosmidis | last post: by
30 posts views Thread by Takehiko Abe | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.