By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,536 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,536 IT Pros & Developers. It's quick & easy.

Response.Write font size & face

P: n/a


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
Share this Question
Share on Google+
3 Replies


P: n/a
<%
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

P: n/a
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

P: n/a
"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.