place a box (border) around text on html page

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;">
     &nbsp;&nbsp;&nbsp; a ) PER ... <br />
    &nbsp;&nbsp;&nbsp; b ) temp is: 1300 <br />
    &nbsp;&nbsp;&nbsp; c) temp2 is 1500 <br />

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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>

2. Inline:  
<span style="border:1px solid black">Your stuff here</span>
PACCAST-DEVAuthor Commented:
div method extends box beyond text to the end of the page,
span method has same problem as orignal html
please see pictuer

To use the div method, you can add in a fixed width to the inline style like so:
<div style="border:1px solid black; width:500px" >Your stuff here</div>
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

PACCAST-DEVAuthor Commented:
I would like the box to wrap around the text, not be the same static width no matter the width of the text and either extend way past it or force it into a box the size of the div tag...
It sounds like you want the <span> version then. Did you try that? It's "inline" meaning it only extends as wide as the text it surrounds.
Sorry, I see that you did try the span.  
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PACCAST-DEVAuthor Commented:
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 = "" 
If dr("FormatBold") = True Then
baseText = baseText.Insert(0, "<b>")
baseText = baseText.Insert(baseText.Length, "</b>")
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;'>"
fontText &= ">" 
End If
baseText = baseText.Insert(0, fontText)
baseText = baseText.Insert(baseText.Length, "</font>")
If dr("FormatUnderline") = True Then
baseText = baseText.Insert(0, "<u>")
baseText = baseText.Insert(baseText.Length, "</u>")
End If
If dr("FormatItalicized") = True Then
baseText = baseText.Insert(0, "<i>")
baseText = baseText.Insert(baseText.Length, "</i>")
End If
Catch ex As Exception
End Try
End Sub
PACCAST-DEVAuthor Commented:
hello, anyone with any feedback given my last post?...
PACCAST-DEVAuthor Commented:
Appears this is not possible...
PACCAST-DEVAuthor Commented:
please close
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.