How to surround text with a rectangle?

B

Bruce W...1

To make a one pixel box around text (or whatever) in the past I've
enclosed a table within a table. But I get the feeling there's an
easier way.

Seems like it has something to do with the div tag and style sheet.
What attribute of a div tag would cause a single pixel box? How is this
done?

Thanks for your help.
 
E

Eric Bohlman

To make a one pixel box around text (or whatever) in the past I've
enclosed a table within a table. But I get the feeling there's an
easier way.

Seems like it has something to do with the div tag and style sheet.
What attribute of a div tag would cause a single pixel box? How is this
done?

Border. Check any CSS tutorial for how to specify it. Note that you can
specify a border for any element, not just a <div>; for example, a style of

p {border: 1px solid black;}

will put a border around every paragraph.
 
B

brucie

To make a one pixel box around text (or whatever) in the past I've
enclosed a table within a table.
aaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

But I get the feeling there's an easier way.

<p style="border:1px solid red;">some text</p>

although external css is much better than inline. e.g:

in your <head>:
<link rel="stylesheet" href="style.css" type="text/css" media="screen">

the content of the style.css file:

..red-border{border:1px solid red;}

in your html:

<p class="red-border">some text</p>

or you may want to put the css in your <head> (still not as good as
external)

<style type="text/css" media="screen">
..red-border{border:1px solid red;}
</style>

<p class="red-border">some text</p>
 
B

Beauregard T. Shagnasty

Bruce W...1 pounced upon this pigeonhole and pronounced:
To make a one pixel box around text (or whatever) in the past I've
enclosed a table within a table. But I get the feeling there's an
easier way.

Seems like it has something to do with the div tag and style sheet.
What attribute of a div tag would cause a single pixel box? How is this
done?

..bordered { border: 1px solid red; padding: 0.25em; }


<p class="bordered">This text has a box around it, with some space in case
you asked.</p>
 
S

Sid Ismail

: To make a one pixel box around text (or whatever) in the past I've
: enclosed a table within a table. But I get the feeling there's an
: easier way.

Pad your table using CSS. :)

Sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top