Click to See Complete Forum and Search --> : centering text


shashgo
11-25-2006, 11:58 PM
In line with some of the other advice I have gotten from here, like adding spaces with
.indent1{margin-left:75px;}

and then using <span class="indent1">Some text</span>

I tried centering text with
.ctr{text-align:"center";}
and
<span class="ctr">Some text</span>

but it doesnt work. Shouldnt it work?

mooi
11-26-2006, 01:56 AM
<span> tags are by default inline tags so if you want it to be centered, either use a div tag with your .ctr CSS class or add display:block to the .ctr class.

eg.
.ctr {display:block;text-align:center}

Also, you shouldn't need the quotes around center when declaring it as text-align: center - see above.

cheers :)

Fang
11-26-2006, 02:04 AM
Also, you shouldn't need the quotes around center when declaring it as text-align: center - see above. Is an error so the declaration is not applied.

You MUST use quotes when the property value has spaces:font-family: "MS Serif", "New York", serif;

shashgo
11-26-2006, 05:43 PM
Thanks guys, Im using the h3 tag along with a class to center text. Now there are some more issues.

I want to make a table that spans the entire width of the browser
<table border="1" width="100%">

then I have a row in which I have four text elements that I want going all the way left to right with appropriate number of spaces in between. I could say
<td colspan="5">
and then type the text with &nbsp; in between to spread out the four items and so the fourth one is right aligned in the row. Im just wondering though, is there an easier way?

Next row has 5 text elements again (this time I do want the vertical lines that separate the cells), and where each cell is of a different width. So Im assuming I have to do a <td width="...%"> for each cell. Will that achieve the effect I want?

On the bottom of the page I want a link to the previous page and a link to the next page, so that both are on the same line at opposite sides of the current page. How do i do that?

WebJoel
11-26-2006, 05:53 PM
That is alot of questions for one request, -but here's a quickie reply to the last question... it is not "TABLE" though. It is better~than.

<div style="width:90%; margin:10px auto; padding:4px; border:1px dashed silver;">
<a title="Previous Page" href="#nogo" style="float:left; white-space:nowrap;">Previous page</a><a title="Next Page" href="#nogo" style="float:right;white-space:nowrap;">Next page</a>
</div>

shashgo
11-26-2006, 06:24 PM
Webjoel: Cool! I used your line modified it a little and it works.
If you know how to equispace four text elements in a row that is five columns wide please lemme know.

One more: How do you insert a textarea in a row so that the textarea occupies the entire width of the row?
I tried <textarea width="100%">. didnt work
I tried <textarea rows="2" cols="100%">. didnt work
In both cases the textarea only occupies some width in the center (that is because I have <td colspan="5" align"center">
What am i doing wrong?