Free Republic
Browse · Search
General/Chat
Topics · Post Article

Skip to comments.

HTML Sandbox 2012
Free Republic | 01 January 2012 | Free Republic

Posted on 01/01/2012 5:09:33 PM PST by ShadowAce

It's time for a new HTML reference so you can make your posts look cool.

HTML means Hyper Text Markup Language. It's a set of simple commands used to format the text of your posts, add images, or links, or change the appearance.

URL is Uniform Resource Locator. It's the name of the page or the picture that you see, the www.http:// stuff. You'll need to use the URL to make links and post pictures.

Quotation Marks Quotes have to be used around the URLs for web pages and images on Free Republic. Some systems do not require this. Ours does.

Once the Free Republic software detects an HTML tag in your post, it will assume the entire thing was written for HTML. This means it will eliminate paragraphs and line breaks that you used to clarify your writing. In order to prevent that, I'll start with the two simplest tags, <br> and <p>. When you use html tags, they disappear when the post is pasted to the board, so don't worry if they look funny or if your post seems to run on.

This is the break tag. <br>
It tells the computer to end the line and start a new one. <br>
Just type it where you want the line to end. <br>

This is the paragraph tag. <p>

It tells the computer to end the line, insert a blank one, then start a new line.

The rest of the tags have to be used with an on tag and an off tag. This is simple enough. One of the most commonly used tags is the italic tag <i>. This tag turns the italics on. When you want the italics to end, turn them off by using the forward slash with the appropriate command, in this case, </i>.

Commonly used tags:
<p> paragraph
<br> line break
These tags are not used in pairs.

Commonly used pairs:
<i> </i>italics
<b> </b>bold characters
<u> </u>underline
<font color = red>This makes the font red.</font color = red> Orange,blue,green,purple,and yellow also work.
<center> </center>

This will put whatever is between the tags in the center of the page
and center justify the margins.

Headline fonts
Headlines add emphasis to an important point.

<h1> SIZE 1 </h1>

<h5> SIZE 5</h5>

You can use 1,2,3,4, or 5. The tags automatically insert a blank line between the headline and your next paragraph.

Font Face
<font face="helvetica, georgia, courier, arial">
what you are reading now will be rendered in the helvetica, georgia, courier or arial font. Your computer will search for each of the fonts and render this text in the first one it finds installed on your computer. If non of the fonts are installed, your computer will render this text with whatever you have installed as your default font
</font>

Lists
I use <blockquote> a lot;

as you know it indents the following text like this.
I also like to use lists:
numbered list:<OL>
    <LI>
  1. first item<LI>
  2. second item<LI>
  3. third item
</OL>end of list.

Bullet point lists:<UL>

</UL>end of list.

definition lists:<DL>

<DT>
term </DT> <DD>
meaning </DD> <DT>
next term </DT> <DD>
meaning </DD>
</DD>
</DL>

Sarcasm tag
</sarc> This is the sarcasm tag. It is not a real HTML tag. It is used to mark your witty repartee so that everyone will know you are making a funny. Type an ampersand - & then lt; then /sarc. An & and gt makes the other carat >.

How to create a link:
<a href="http://www.freerepublic.com/home.htm">www.Free Republic.com</a>
A means anchor. H ref means horizontal reference. It's called horizontal because the computer is going across the web to a different page. There are also vertical links that can go to specific points on the same page. What comes after the a href= is where the computer will go. The horizontal reference is the complete URL of the page you want to link. It's in the navigation bar at the top of your web browser. Highlight it and copy it. Make sure you get all of it. Some URLs are surprisingly long, and if you miss some of the URL, the link might not work.
You can type anything between the <a href=></a> parts.
www.Free Republic.com
Click here.
abc12345
All of these links go to the same page, I just typed different things between <a href=></a> tags.

How to add images to your post:
<img src=></img>
The img tags tell the computer to find and insert a picture.
These tags insert this wonderful image from Rush Limbaugh's website:
<img src="http://www.rushlimbaugh.com/home/daily/site_062807/content/01125113.Par.4584.ImageFile.jpg""height=218""width=285"></img>

You need to know the URL of the picture to do this. You can see the picture's URL when you put your cursor on the picture and right click the mouse. You see a small box with "properties" at the bottom. Left click on "properties" and you get a dialog box with the image URL and dimensions. It says Address: next to the URL, with (URL) underneath. Copy the URL and paste it after your img src= tag. Make sure you get all of the URL for the picture. There isn't a lot of space for the URL and sometimes they are very long. The image Size and Dimensions are beneath the URL. Free Republic allocates memory for each image, and if it doesn't know the dimensions of the image, it will allocate more memory than needed. It tells you the width, then the height of the picture.

This is called a hotlink. The picture is actually on another computer, but we see it here. This causes the other computer to use it's memory and machinery to provide the image. Some sites prevent it, or object to it. You can't hotlink an image from any of Yahoo's GeoCities pages, for example. Yahoo prevents it.

Do Not Cut And Paste List.
Some websites have forbidden us to copy and paste their material, including images. There have been lawsuits over this. The software will mostly prevent you from using the material that has been blocked, but not always. There are also some image sources that are not allowed on the list. Please don't use them. Lawsuits suck.
Link to the Do Not Cut And Paste List

Help With Creating HTML Tables

Basic Table Tags

The three most important tags for tables is the opening table tag, <table> and the table row and table data tags - <tr> and <td> respectively.

The <tr> tag represents a row for the table

The <td> tag represents a cell (or column) inside the row.

Now, with that in mind, let's create a simple table:

<table>

<tr>  
<td>A</td>
<td>B</td>
<td>C</td>  
</tr>

<tr>  
<td>X</td>
<td>Y</td>
<td>Z</td>  
</tr>

</table>

And this is what the table would look like published:

A B

C

X Y Z

Notice that by looking at the code, you can tell how many rows and columns are included just by looking at the code.  The two opening <tr> tags indicate two rows and the three opening <td> tags on each line represents three data cells (or three columns).

So if you wanted to add another row, you would just start with another <tr> and so forth....

Adding Table Borders

Adding a border simply involves inserting the border attribute to the opening table tag. So in the above table the code would be adjusted accordingly:

<table border="2">

<tr>
<td>A</td> 
<td>B</td> 
<td>C</td>
</tr>

<tr>
<td>X</td> 
<td>Y</td> 
<td>Z</td>
</tr>

</table>

Notice the "2" represents the thickness of the border. If you had set it to "0" then there would have been no border at all. If you wanted it very thick then you could set it to 8, for example.  So now your table will look like this:

A B

C

X Y Z

Changing a Table's Border Color

(Does not seem to work on FR)

You can change the color of a table border by simply adding the bordercolor attribute.

<table border="2" bordercolor="red">

<tr>
<td>A</td> 
<td>B</td> 
<td>C</td>
</tr>

<tr>
<td>X</td> 
<td>Y</td> 
<td>Z</td>
</tr>

</table>

And here's what it would look like...

A B

C

X Y Z

Adjusting Table Cell Spacing and Cell Padding

You can increase the space within the table cells and the space between the cells by using the cellpadding and cellspacing  attributes.

The cellspacing attribute adjusts the space between the cells and cellpadding adjusts the space within (around) the cell.

<table border="2" cellspacing="10" cellpadding="3">

<tr><td>A</td>  <td>B</td>  <td>C</td> </tr>

<tr><td>X</td>  <td>Y</td>  <td>Z</td> </tr>

</table>

This is what the table would look like now...

A B

C

X Y Z

See how setting the cellspacing attribute to "10" drastically increased the spacing between the cells, and the cellpadding attribute set to "3" added a little of space within each individual cell.

If you want a table to have a single border (with no border around the letters), simply set the cellspacing to "0" and your table will look like this....

A

B C

X Y Z

Specifying a Table Width

You can specify the width of a table by using either a percentage or a pixel width.

<table width="100%" border="2">

<tr>
<td>A</td> 
<td>B</td> 
<td>C</td>
</tr>

<tr>
<td>X</td> 
<td>Y</td> 
<td>Z</td>
</tr>

</table>

Since the width is set to 100% that means the table will take up 100% of the screen and the columns in the table will be adjusted evenly.  Here's what it would look like.

 

A B

C

X Y Z

As we mentioned, you can also set the table width using pixels instead of percentages.  So instead of setting it to 100%, you could set it to 300 pixels:

<table width="300" border="2">

<tr><td>A</td>  <td>B</td>  <td>C</td> </tr>

<tr><td>X</td>  <td>Y</td>  <td>Z</td> </tr>

</table>

The table would look like this:

A B

C

X Y Z

Setting Column Widths

Sometimes you may not always want your columns to be the same width.  If this is the case, you need to set values on your table data <td> cells.  Again, you can set them by using percentages or pixel widths.

<table width="300" border="2">

<tr>
<td width="70%">
A</td>
<td>B</td>
<td>C</td>
</tr>

<tr>
<td width="70%">
X</td>
<td>Y</td>
<td>Z</td>
</tr>

</table>

This is what this table would look like.
 

A B

C

X Y Z

See how the column width for the first column in both rows is set to 70%.  Notice there is no value set for the other 2 columns.  If you do not set a value for the remaining columns, their width will automatically be adjusted to take up the remaining space and they'll share it equally.

Since the table width is set to 300 pixels, and the first column is instructed to take up 70% of those 300 pixels (roughly 210 pixels), the other 2 columns divide the remaining 30% of the table equally (roughly 45 pixels a piece).

You could also have expressed the column widths of this table in pixels instead of percentages.  The code would have looked like this:

<table width="300" border="2">

<tr>
<td width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

<tr>
<td width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

</table>

 

A B

C

A B C

 

See how the width of the columns in each row add up to 300 (210 + 45 + 45) -- which is the width of the table.

What's the Difference Between Using Percentages and Pixel Widths?

Many people prefer to express their table width and column widths in percentages because that will ensure that the table takes up the same amount of screen no matter how big or small the screen resolution is. 

If someone is using a 21 inch monitor to view your site and you have a table width set to 300 pixels, the table will show up very small on their screen.  However if you set the table width to 70%, it will take up 70% of the screen no matter what size monitor the person is using. 

Or, let's say you create a table that is 760 pixels wide and someone has a 15 inch monitor set to a 640x480 resolution, then that person will have to scroll left and right just to see the entire table. 

On the other hand, if you set the table width to 100%, the table will fit the screen no matter what resolution the browser is set to.

So it's really up to you to decide what's the best layout for your tables. Personally I prefer to use percentages.  That way the table takes up the same amount of screen no matter what size monitor/resolution people are using.

Specifying a Table's Height

You can also set the table height by adding the height tag to the table code.

<table height="250" width="300" border="2">

<tr>
<td width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

<tr>
<td width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

</table>

Which will produce the following table:

A B

C

A

B C

Horizontally Aligning the Content Inside Tables

The content inside a cell is left aligned by default, but you can also center or right align the text as well by using the align attributes.

<table width="300" border="2">

<tr>
<td width="210" align="center">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

<tr>
<td width="210" align="center">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

</table>

 

A B

C

A B C

See how the first column is aligned to the center?  You can also right align the columns by using the align="right" inside the <td> cells.

Vertically Aligning the Content Inside the Table Cells

So far we've kept the table cell alignment at the default, which is the middle.  Notice in the above table that the A, B, and C are all three aligned in the middle of their cells.  Well you can change their alignment to either top, bottom, or middle by using the valign (which stands for vertical align) tag:

<table height="250" width="300" border="2">

<tr>
<td valign="top" width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

<tr>
<td valign="top" width="210">A</td>
<td width="45">B</td>
<td width="45">C</td>
</tr>

</table>

 

A B

C

A B C

I've set the table height to "250" so the alignment would be more noticeable. Notice that the A in both rows are aligned to the top.  You can also align to the "bottom" or the "middle".

Creating a Left Navigation Layout With Tables

As we mentioned earlier, most left and right navigations are created using tables.  All you do is create a table with one row, two columns and no border.  Then align both of your columns to the top (using the valign tag) so your text will start in the top of the columns, not the middle.  Then depending on if you're going to have a right or left navigation, you'll make one column significantly smaller than the other.

Here's a simple left navigation layout:

<table width="100%" border="0">

<tr>
<td valign="top" width="25%">Left Nav Links Here</td>
<td valign="top" width="75%">Body Here</td>
</tr>

</table>

And here's what it would look like: 

Left Nav Links Here Body Here

 

Notice I set the border to "0" but it's still showing in the example.  I just did that to show how the layout would look. If you set your border to "0" you won't see any lines around your table.


So there ya have it!  That's a general overview of tables.  There's so much more you can do with them, but if you can understand the basic layout, you'll be able to do so much with the design of your web site.


TOPICS: Computers/Internet
KEYWORDS: html; htmlsandbox; htmlsandbox2012; newbies; repository; sandbox
Navigation: use the links below to view more comments.
first previous 1-2021-4041-6061-80 ... 121-128 next last
To: ShadowAce
www.superbad.com
41 posted on 01/02/2012 8:59:39 AM PST by ßuddaßudd (7 days - 7 ways a Guero y Guay Lao << >> with a floating, shifting, ever changing persona)
[ Post Reply | Private Reply | To 1 | View Replies]

To: ShadowAce
My first attempt at posting an image, using "hot-linking," courtesy of 2011's best player, Matt Kemp. Looks fine on "Preview"!


42 posted on 01/02/2012 10:55:11 AM PST by Hebrews 11:6 (Do you REALLY believe that (1) God IS, and (2) God IS GOOD?)
[ Post Reply | Private Reply | To 1 | View Replies]

To: ShadowAce

Sadly, I don’t know very many tricks for using FR on mobile devices! I wish I did. I first learned that some OS’s are easier to read FR on, to fit a big enough font into the window perfectly so no scrolling is needed from left o right on each line.

Then I learned about the End of Page app on apple devices (it may be on others as well) where it stays in your bookmark and you can tap it to get to the end of the FR page you are on instantly. Essential for keeping up on a live thread.

And the newest trick i learned is from other people here, that I mentioned. A few little dashes under a desired quotation from another’s post, and FR fills in the whole line, under which you can put your own comment.

I hope other people chime in with more mobile device tricks for FR.


43 posted on 01/02/2012 11:32:14 AM PST by Yaelle
[ Post Reply | Private Reply | To 38 | View Replies]

To: leapfrog0202

I save these threads every year.

You can practice posting anything and everything on this thread!

Easy to understand instructions for all things HTML.


44 posted on 01/08/2012 10:31:02 AM PST by onyx (PLEASE SUPPORT FREE REPUBLIC - DONATE MONTHLY! If you want on Sarah Palin's Ping List, let me know!)
[ Post Reply | Private Reply | To 1 | View Replies]

To: ShadowAce

Bookmarked for later.


45 posted on 01/08/2012 10:34:08 AM PST by Godebert (NO PERSON EXCEPT A NATURAL BORN CITIZEN!)
[ Post Reply | Private Reply | To 1 | View Replies]

To: ShadowAce
bookmarked

46 posted on 01/15/2012 9:51:54 AM PST by Yogafist
[ Post Reply | Private Reply | To 1 | View Replies]

To: Scoutmaster
Test of a 495-pixel-wide table, with one 300- and four 40-pixel columns, 5-pixel cellpadding (5+300+5+40+5+40+5+40+5+40+5+40+5=495)

Border=2 for viewing

Should be 300 I’m 40 So am I: 40 40? That’s me Copycat 40
Align left And center Center Center Ditto

Why are all the columns showing the same size in the preview?

I distinctly included the width="300" and width="40", did not use "px", just the number.

47 posted on 01/16/2012 1:41:31 PM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 46 | View Replies]

To: Scoutmaster
Should be 300 I’m 40 So am I: 40 40? That’s me Copycat 40
Align left And center Center Center Ditto

 

Here's what I did to correct it--

Remove the table size. I don't know if that affected it, but with the sizes of the columns specified, it's not needed.

Removed the quotes from "left" and "center" in the align attribute.

48 posted on 01/16/2012 5:10:32 PM PST by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 47 | View Replies]

To: ShadowAce
HTML Help Threads for Newbies
(And Anyone Else Who Needs It)






Got the original from Backhoe and I have tried to keep it up on my page so here it is again Thanks for posting the new thread ShadowAce!
49 posted on 01/16/2012 5:19:50 PM PST by Rightly Biased (Do you know how awkward it is to have a political argument with a naked man?)
[ Post Reply | Private Reply | To 2 | View Replies]

To: ShadowAce
I tried it (in preview) without a table size and it didn't work. Notice that as you posted it, the three 40-pixel columns are not not same width, and the 175-pixel-width column is not 175 pixels wide (at least not on my MacBook Pro or large MacPro monitor). The widths of the columns appear to be set by the text of the headers, not the 'width="x"' HTML column-width specification. You've seen my markup language in the FReemail.

Curious, eh?

50 posted on 01/16/2012 5:42:23 PM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 48 | View Replies]

To: Scoutmaster
I meant to notice that as well in my remoarks--

I do believe that if the text would fit wthin the 40 pixel size, then the columns would be the correct size. However since text i important in a table, it must put the text as written into the column. Since the text is not negotiable, the column width must give way to fit the text.

Try the same thing with no text, or a single char and see if that works:

300 . . . .
Align left . . . .

 


51 posted on 01/17/2012 3:36:05 AM PST by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 50 | View Replies]

To: ShadowAce
I do believe that if the text would fit wthin the 40 pixel size, then the columns would be the correct size. However since text i important in a table, it must put the text as written into the column. Since the text is not negotiable, the column width must give way to fit the text.

Thanks.

I'm viewing at 1920x1200 resolution. The 175-pixel column isn't remotely close to 175 pixels wide, nor are the 40-pixel columns close to 40 pixels. I don't think any em adjuster or other cascading styles on the freerepublic.com style sheet affects that, does it?. The columns don't appear to be affected by the 'width' tag, but auto-size to fit the widest text among the cells within that column. Correct?

Also, can you wrap text in a table cell without using a div and css - and without getting a scroll bar? Four pages of Google results didn't yield an answer. All gave me scroll bars or divs/css. I've used divs for so long that this is a refresher course for me in tables.

52 posted on 01/17/2012 5:27:15 AM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 51 | View Replies]

To: Scoutmaster
The columns don't appear to be affected by the 'width' tag, but auto-size to fit the widest text among the cells within that column. Correct?

The columns are the width of the widest part of the content--either the width tag, or the text within the column. If the text fits within the width tag value, then the column is the width of the tag--otherwise it is the width of the text.

Also, can you wrap text in a table cell without using a div and css - and without getting a scroll bar?

Try breaking up the text using <br> tags.

53 posted on 01/17/2012 5:51:38 AM PST by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 52 | View Replies]

To: ShadowAce
The columns are the width of the widest part of the content--either the width tag, or the text within the column.

Is the phrase "Align left" wider than 175 pixels? That phrase is setting the width of the first column (on my 1920x1200 resolution monitor, Firefox window at near maximum size - Mac)

54 posted on 01/17/2012 6:21:47 AM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 53 | View Replies]

To: Scoutmaster
Hmm--Not sure. On my monitor, I see a wider column there, with the text left aligned properly. It takes less than half the column width.

My display is 1680x1050 on a Dell P2210, with Firefox maximized on this screen.

55 posted on 01/17/2012 7:57:13 AM PST by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 54 | View Replies]

To: ShadowAce
On my monitor, I see a wider column there, with the text left aligned properly. It takes less than half the column width.

Thanks. It's a browser-specific issue. Worked for me in Firefox.

Even with a good 'reset' CSS, a web designer deals with browser-specific issues. Lots of them for IE6, and CSS rounded corners, transparency, shadows, and @font-face are handled differently by IE and mozilla than other browsers.

I just didn't expect something as established as tables to be treated differently by different browsers.

56 posted on 01/24/2012 5:27:19 AM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 55 | View Replies]

To: Scoutmaster
I just didn't expect something as established as tables to be treated differently by different browsers.

That is an interesting observation. I would not have expected that, either.

57 posted on 01/24/2012 5:38:17 AM PST by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 56 | View Replies]

To: ShadowAce
That is an interesting observation. I would not have expected that, either.

When I'm designing a website, I'll use Adobe Browser Lab, bowsershots.org, or another system to test a site in various browsers and various versions of those browsers.

Now that Netscape's not in the picture, headaches are primarily confined to IE (and let's not even talk about IE6), the browser that doesn't think it has to play by the rules ("I'm getting better," in Monty Python parlance, IE says). Although there are Mozilla-specific CSS rules for @font-faces and rounded corners, etc.

I was using Safari Version 5.1.2 (6534.52.7) on OS X Version 10.6.8 (Firefox runs slow, and Chrome is just too streamlined some of the time; Opera's okay), and it simply doesn't show tables correctly. I kick among four browsers depending on what I'm doing. The table widths show fine in everything except Safari.

Odd. As I said, I was taking a table refresher because tables were replaced by the

element in HTML for so much so long ago- unless you really need a table. Somebody in Cupertino must have decided "tables? Who needs a browser that shows tables correctly."

Thank you for all of your help. I'm posting this reply in Firefox.

58 posted on 01/24/2012 3:04:11 PM PST by Scoutmaster (You knew the job was dangerous when you took it)
[ Post Reply | Private Reply | To 57 | View Replies]

To: onyx
FIRST TRY
After NV
Delegate tally approximately
Romney 51 Newt 45
when FL vote divided per RNC rules!

Pass the word!


CLICK TO DONATE TO NEWT

CONTACT FOR RNC:
website@nrcc.org

310 First Street
Washington DC 20003

Encourage them to do the RIGHT thing: end the FL fiasco NOW!
Play by RULE 15:B:2

59 posted on 02/07/2012 10:03:03 AM PST by hoosiermama (Stand with God and Sarah and Newt will be standing next to you.)
[ Post Reply | Private Reply | To 2 | View Replies]

To: hoosiermama
test
[IMG]http://i120.photobucket.com/albums/o177/camaniac/terryfront1.jpg[/IMG] or
[IMG]http://i120.photobucket.com/albums/o177/camaniac/terryfront1.jpg,/img> or
[IMG]http/www.i120.photobucket.com/albums/o177/camaniac/terryfront1.jpg
60 posted on 02/26/2012 11:25:31 AM PST by freebird5850 (Of course Obama loves his country...it's just that Newt loves mine!)
[ Post Reply | Private Reply | To 59 | View Replies]


Navigation: use the links below to view more comments.
first previous 1-2021-4041-6061-80 ... 121-128 next last

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
General/Chat
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson