Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

HTML help? How can I put a box around text like

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 10:54 PM
Original message
HTML help? How can I put a box around text like
this:


Example


on my own website?

Printer Friendly | Permalink |  | Top
NYC Liberal Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 10:55 PM
Response to Original message
1. You need to use a stylesheet.
Search Google for CSS basics.
Printer Friendly | Permalink |  | Top
 
KitchenWitch Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 10:56 PM
Response to Original message
2. You could also do a table
using only 1 cell and 1 row!
Printer Friendly | Permalink |  | Top
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:03 PM
Response to Reply #2
3. But how would I get it to look that nice? nt
nt
Printer Friendly | Permalink |  | Top
 
sendero Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:10 PM
Response to Reply #3
4. Use a table...
.... you can specify a border, bordercolor, background color and cell padding/cellspacing.

Something like this:
<TABLE width=100% cellspacing=0 cellpadding=4 border=1 bordercolor=#f0f0f0>
<TR><TD> here is some text
</TD></TR>
</TABLE>
Printer Friendly | Permalink |  | Top
 
salvorhardin Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:35 PM
Response to Original message
5. Short answer/DIY answer
Edited on Wed Jan-26-05 11:37 PM by salvorhardin
Short answer
You can use an inline style to specify background color, padding and border properties (among other things).

<p style="background-color: #d0d0d0; border: solid thin #7f7f7f; padding: 1em;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus vel lorem sed elit aliquam luctus. Donec turpis. In venenatis sem eget dui. Aliquam condimentum feugiat elit. Nunc suscipit luctus turpis. Suspendisse potenti. Integer ultrices. Nam placerat. Morbi nisl urna, venenatis vel, ullamcorper eget, imperdiet ac, nibh. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>


Would make your paragraph have a light gray background color with a darker gray thin solid border and 1 em worth of padding all around. If you want multiple paragraphs then you can wrap them in a <div> tag.

<div style="background-color: #d0d0d0; border: solid thin #7f7f7f; padding: 1em;">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In purus. Nullam vel metus. Nam ornare. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Quisque sem tortor, consequat eget, tincidunt quis, cursus eget, magna. Aliquam convallis. Praesent pulvinar. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam a quam. Suspendisse potenti. Integer leo. Nulla venenatis, odio vel consequat rutrum, est nulla luctus eros, sit amet euismod ligula est eu erat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum vitae urna non leo feugiat elementum. Etiam consequat risus vitae magna. In nonummy turpis in nunc.</p>

<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam in magna. Duis ante magna, luctus eget, lobortis vitae, blandit eu, eros. Phasellus vitae mi. Etiam quis nibh. Duis diam nulla, vulputate dictum, dignissim in, mattis non, justo. Duis augue odio, pulvinar vitae, sagittis quis, facilisis eu, ante. Sed lectus ante, porta vel, sagittis eget, aliquet nec, risus. Duis eu enim. Praesent vel ante vitae orci mollis blandit. Phasellus ultrices orci molestie nisl. Vestibulum volutpat magna sit amet turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras urna libero, lobortis in, blandit id, dapibus ut, est. Nullam at leo nec nisl posuere convallis.</p>
</div>


DIY answer
http://www.w3schools.com/css/default.asp

Lorem ipsum generator for generated greeking goodness
http://www.lipsum.com
Printer Friendly | Permalink |  | Top
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:44 PM
Response to Reply #5
8. What if I want the box less-wide than the rest of the text and
Edited on Wed Jan-26-05 11:47 PM by Eric J in MN
right-aligned with that approach?

In other words, what about indenting?

UPDATE: I just found that using blockquote will indent it, as in:
http://www.moveleft.com/quote2.html

Thanks, that is a good approach.
Printer Friendly | Permalink |  | Top
 
salvorhardin Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:56 PM
Response to Reply #8
9. Check out using margin properties in the style
Edited on Thu Jan-27-05 12:02 AM by salvorhardin
<blockquote> works, and is just fine. You can specify this using CSS too.

For example:
<div style="background-color: #d0d0d0; border: solid thin #7f7f7f; margin-left: 3em; margin-right: 3em; padding: 1em;">
<p>
Lorem ipsum dolor sit amet...</p>
</div>


Would indent both the left and right margins by 3 em.

When you get to using actual style sheets, this is handy because you can specify (for instance) different levels on indenting, and then apply them with a simple <div class="myclassname"> tag. :-)
Printer Friendly | Permalink |  | Top
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Jan-27-05 12:02 AM
Response to Reply #9
10. What does em stand for? nt
nt
Printer Friendly | Permalink |  | Top
 
salvorhardin Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Jan-27-05 12:17 AM
Response to Reply #10
11. Sorry...
Edited on Thu Jan-27-05 12:22 AM by salvorhardin
An em is a typographical measurement. In olden days, an em was supposed to be literally the width of a capital 'M' in whatever typeface one was using. Nowadays it's just the font's body size (length from lowest descender to highest ascender). It's where we get the term 'em dash' from, the dash that is supposed to be 1 em wide.

In CSS you can specify measurements in a wide variety of ways. On screen you're probably most interested in %, px (pixels), pt (points) and em. However, you can also specify pc (picas), mm, cm, in, and ex (the height of a lowercase 'x' in the current font). There may be more I'm forgetting. :-) A lot of these come in handy if you're specifying a print media rule for your stylesheet (by specifying different styles for different types of media it makes it easy to do things like add a printer-friendly format without redoing the whole web page).

In general, its' best to use relative measurements rather than absolute measurements (e.g. % rather than px).

On edit: Handy reference.
http://www.w3schools.com/css/css_units.asp
Printer Friendly | Permalink |  | Top
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Jan-27-05 02:05 AM
Response to Reply #11
12. Ok, thanks for your help (nt)
nt
Printer Friendly | Permalink |  | Top
 
Eric J in MN Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:38 PM
Response to Original message
6. Thanks everyone.
I came up with this page with your help:

http://www.moveleft.com/quote.html

Printer Friendly | Permalink |  | Top
 
KitchenWitch Donating Member (1000+ posts) Send PM | Profile | Ignore Wed Jan-26-05 11:39 PM
Response to Reply #6
7. Looks good Eric!
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Mon May 06th 2024, 10:33 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC