Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   HTML / XHTML / CSS (http://www.programmingforums.org/forum27.html)
-   -   Aligning text (http://www.programmingforums.org/showthread.php?t=11179)

azurik Aug 26th, 2006 6:42 AM

Aligning text
 
This is just about as noobie of a question as it gets... I want to create text so that some is on the left and some is on the right of the same line. Eventually, I'll be making them links to the previous and next pages of a manual-type document. This is what I tried to do:
:

<HR><H3>
<DIV ALIGN="left"><< Previous</DIV>
<DIV ALIGN="right">Next >></DIV>
</H3><HR>
</BODY></HTML>


It turned out so that they were on the left and right sides, though the "Next >>" text was one line below the "<< previous" text.

I'm just learning to code HTML and so far have just read "Learning HTML in 14 days" (written in 1997, which I wish I would have realized sooner...) so any advice on references of what has happened to HTML in the past decade would be of help to me. (Will move up to DHTML after I get a bit of practice with HTML.)

Agent 47 Aug 26th, 2006 6:55 AM

<div>s are block level elements, hence the line break.

Use <span>s and float them.
:

<hr />
<h3>
        <span style="float:left;"><< Previous</span>
        <span style="float:right;">Next >></span>
        <div style="clear:both;"></div>
</h3>
<hr />


Quote:

(Will move up to DHTML after I get a bit of practice with HTML.)
DHTML is nothing more than a marketing buzz-word. All it is is a combination
of HTML and JavaScript to make annoying and distracting things happen on
the page - It is XHTML you should be learning. ;)

There are plenty of resources out there. Just google for 'HTML Tutorials' or
something. w3Schools is, as always, a good place to start.

Here's some links you might find useful:

http://www.w3.org/QA/2002/04/valid-dtd-list.html
http://validator.w3.org/

http://www.westciv.com/style_master/...l/dead_layout/
http://www.hotdesign.com/seybold/index.html

http://www.w3schools.com/css/default.asp
http://glish.com/css/
http://www.bluerobot.com/web/layouts...horizdropdowns
http://www.quirksmode.org/css/condcom.html

azurik Aug 26th, 2006 7:13 AM

The <span> tag works. Thank you. :) <span> was never mentioned in the '97 book, but I'll be looking it up along with the references you suggested. So thanks again.

a thing Aug 26th, 2006 12:46 PM

Dump the '97 book. The web's moved on to XHTML/CSS.

I recommend W3schools, it's where I learned.

By the way, is there a way to get text in the middle of that line without assuming the font-size on the browser is a typical font size?

Agent 47 Aug 26th, 2006 1:27 PM

Just apply text-align to the <h3>
:

<hr />
<h3 style="text-align:center;">
        <span style="float:left;"><< Previous</span>
        <span style="float:right;">Next >></span>
        This should be in the middle.
        <div style="clear:both;"></div>
</h3>
<hr />


grimpirate Aug 26th, 2006 4:58 PM

Here's another way though not as efficient I suspect.
:

<HR><H3>
<table border="0" width="100%">
<td align="left"><< Previous</td>
<td align="right">Next >></td>
</table>

</H3><HR>
</BODY></HTML>


Agent 47 Aug 26th, 2006 5:06 PM

It's got nothing to do with efficiency, grim. Tables are for displaying
tabular data. What about this data is tabular?

grimpirate Aug 26th, 2006 5:10 PM

Absolutely nothing, I use tables as a grid-like interface for visual formatting, not just for tabular data. I concur that you are correct though, in the strictest sense, tables are exclusively for tabular data. However, my pirate creed forces me to use and abuse all HTML tags at my whimsy ahahahaha. Just check my website for an example *_*


All times are GMT -5. The time now is 1:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC