PACCAST-DEV
asked on
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;">
3) H.I.P. TO THE FOLLOWING SPECIFICATION: <br />
a ) PER ... <br />
b ) temp is: 1300 <br />
c) temp2 is 1500 <br />
</font>
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>
ASKER
div method extends box beyond text to the end of the page,
span method has same problem as orignal html
please see pictuer
textbox.JPG
span method has same problem as orignal html
please see pictuer
textbox.JPG
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>
<div style="border:1px solid black; width:500px" >Your stuff here</div>
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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 ength, "</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;'>"
Else
fontText &= ">"
End If
baseText = baseText.Insert(0, fontText)
baseText = baseText.Insert(baseText.L ength, "</font>")
If dr("FormatUnderline") = True Then
baseText = baseText.Insert(0, "<u>")
baseText = baseText.Insert(baseText.L ength, "</u>")
End If
If dr("FormatItalicized") = True Then
baseText = baseText.Insert(0, "<i>")
baseText = baseText.Insert(baseText.L ength, "</i>")
End If
Catch ex As Exception
End Try
End Sub
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
ASKER
hello, anyone with any feedback given my last post?...
ASKER
Appears this is not possible...
ASKER
please close
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>