22 replies
by jiminpa Accepted solution
by robo_dev Accepted solution
by jiminpa Accepted solution
I'm gonna try to post some code... could get ugly being that it is html.
< div align=center >
< form >
< fieldset >
< legend >Fill in the form< /legend >
< br class=clear / >
< label >PC MIS Tag< /label >
< input type=text name=pctag / >
< label >Location< /label >
< input type=text name=location / >
< br class=clear / >
< label id=scantaglabel >Scanner MIS Tag< /label >
< input type=text name=scantagtxt id=scantagtxt / >
< label id=scannerae >Scanner AE Title< /label >
< input type=text id=scanneraetxt name=scanneraetxt / >
< br class=clear / >
< label >Comment< /label >
< input type=text name=comment class=long / >
< br class=clear / >
< label >Whitelisted?< /label >
< input type=checkbox name=whtlistbx / >
< label >Scanner Attached?< /label >
< input type=checkbox name=scannerbx onclick="displayRow()" / >
< br class=clear / >
< /fieldset >
< /form >
< /div >
< div >
< input id="add" type="submit" value="submit" / >
< br / >
< br / >
< br / >
< a href=index.htm > Home< /a >
< /div >
Edit- What a pain it is to post html code :p
by aaron Accepted solution
by shellbot Accepted solution
Ya probably already have, but just thought I'd throw it out there..
(threw in the table for illustrative purposes)
< div align="center" >
< table >
< tr > HI < /tr >
< /table >
< /div >
**When posting HTML in TR have to put a space between < and the character, otherwise it goes invisible!
by jiminpa Accepted solution
by thumbsup2 Accepted solution
If you want to look at the source on this page, you'll see how simple it is to center your form as well as align the elements within the form. Use it if you want to. Sorry for the toot to my own site, but it's too difficult now to post code here.
http://www.chinookequine.org/login
edit: Forgive the formatting, it's done in PHP and I've never taken the time to go back and 'make it pretty'.
by jiminpa Accepted solution
Well I think I see how you are doing it. I just tried to place the whole form in one cell of a table and center the whole thing. The result wasn't exactly what I expected but at least it moved. I'll have to study what you did a little more closely. My elements in the form already line up, I am doing that with a style sheet. I think some of the things I was trying to do in the style sheet to get my form to move may be causing me some issue now.
P.S. You code is WAY prettier than mine so no worries about formatting ;)
by thumbsup2 Accepted solution
Your DIV will center the table, but if the table has a width of 100%, the one cell needs to be centered too (default is left align).
Just in case you can't see the CSS (or don't know how to grab it), the CSS on the outer table (class=mine) only sets the background image.
table.mine { background:#ffffff url('images/CEALogo4TR.jpg') no-repeat inherit center; }
by jiminpa Accepted solution
by thumbsup2 Accepted solution
This works for me.....
< div align=center >
< table >
< tr >
< td align="center" >
< form >
< fieldset >
< legend >Fill in the form< /legend >
< br class=clear / >
< label >PC MIS Tag< /label >
< input type=text name=pctag size="20" / >
< label >Location< /label >
< input type=text name=location size="20" / >
< br class=clear / >
< label id=scantaglabel >Scanner MIS Tag< /label >
< input type=text name=scantagtxt id=scantagtxt size="20" / >
< label id=scannerae >Scanner AE Title< /label >
< input type=text id=scanneraetxt name=scanneraetxt size="20" / >
< br class=clear / >
< label >Comment< /label >
< input type=text name=comment class=long size="20" / >
< br class=clear / >
< label >Whitelisted?< /label >
< input type=checkbox name=whtlistbx value="ON" / >
< label >Scanner Attached?< /label >
< input type=checkbox name=scannerbx onclick="displayRow()" value="ON" / >
< br class=clear / >
< /fieldset >
< input id="add" type="submit" value="submit" / >
< /form >
< br / >
< br / >
< br / >
< a rel="nofollow" href=index.htm > Home< /a >
< /td >
< /tr >
< /table >
< /div >
edit: don't forget to remove the spaces before and after the < and > characters. And, the OnClick gets transformed here in the forum. Silly thing! ;)
by maevinn Accepted solution
by jiminpa Accepted solution
by jiminpa Accepted solution
I had a line in my style sheet
div {text-align:center}
for some reason that didn't seem to be playing nice. As soon as I took that out I was able to use align=center and the thing lined right up? If someone can explain that to me I will gladly hand out more thumbs. This perplexes me but I won't lose sleep over it.
:)
by maevinn Accepted solution
Because it's centering the text within the block, but not the block? The lower levels inherit the attributes from higher level tags, according to this site: http://www.thesitewizard.com/css/center-div-block.shtml
by thumbsup2 Accepted solution
by shellbot Accepted solution
Way I see it, 'text-align' is aligning text..not elements.
So with that in your stylesheet, you were probably overriding any in-line styles.
by jiminpa Accepted solution
by thumbsup2 Accepted solution
Various HTML Tags create a box and that box, as well as it's contents, can be aligned using the margin/padding/borders options.
A DIV tag creates a box. A TABLE tag creates another box which can inherit the properties of the surrounding box (DIV). A TD tag creates another box which can inherit the properties of the surrounding box (TABLE). You simply have to code for all of them in your CSS.
by jiminpa Accepted solution
Every time I learn something new I make sure to make some good notes and file blocks of code away for future reference.
My biggest problem is I'll be asked to do something and I will spend a few days/weeks on the project and then I don't touch code again maybe for a few months. As I said development is not my primary job function it is just common knowledge in the department that I know enough to be dangerous ;)
I try to fiddle around in my spare time but that is so few and far between anymore. It's just nice to know that when I get stuck I have you guys to bail me out :D
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending