div method extends box beyond text to the end of the page,
span method has same problem as orignal html
please see pictuer
how do I create a box around a block of text in html?
I tried this but the borders overlap between lines of text:
<font style="border: 4px solid #0000FF;">
3) H.I.P. TO THE FOLLOWING SPECIFICATION: <br />
a ) PER ... <br />
b ) temp is: 1300 <br />
c) temp2 is 1500 <br />
</font>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Given that you want the border around each line, you probably have to forego doing it all in a single font tag with br. You either need to use a table or use a separate span for each line. There are ways to finagle it to work as you have it (font tag with BRs) -- BUT you'll find that different browsers might display it differently and you'll spend a long time getting to work in all.
Hi all,
this is an intranet app, IE will be the only browser.
I would like it to display similar to the div method (see picture) except the right border to extend only as far as the longest text, i.e. borders around the entire block of text. I am hoping to avoid the table method becase I am building the html in asp code and trying to keep it simple. My page is an aspx page that gets created dynaically, the text comes from a database, and I am adding the html formatting tags (the formatting is stored in the DB also) to it in code like below.
Private Sub FormatText(ByRef baseText As String, ByVal dr As SqlDataReader)
Dim fontText As String = ""
Try
If dr("FormatBold") = True Then
baseText = baseText.Insert(0, "<b>")
baseText = baseText.Insert(baseText.L
End If
' format the font tag
fontText = "<font color='" & dr("FormatColor") & "'"
If dr("FormatLargeFont") = True Then
fontText &= " Size='5' "
End If
If dr("FormatBox") = True Then
fontText &= " Style = 'border: 4px solid #0000FF;'>"
Else
fontText &= ">"
End If
baseText = baseText.Insert(0, fontText)
baseText = baseText.Insert(baseText.L
If dr("FormatUnderline") = True Then
baseText = baseText.Insert(0, "<u>")
baseText = baseText.Insert(baseText.L
End If
If dr("FormatItalicized") = True Then
baseText = baseText.Insert(0, "<i>")
baseText = baseText.Insert(baseText.L
End If
Catch ex As Exception
End Try
End Sub
Business Accounts
Answer for Membership
by: PotentisFrogPosted on 2008-11-07 at 13:17:19ID: 22908606
Not sure if you mean a block of text, or an "inline" span of text. Anyway, you might try this if you want the entire block.
1. Entire block:
<div style="border:1px solid black">Your stuff here</div>
or
2. Inline:
<span style="border:1px solid black">Your stuff here</span>