LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-06-2005, 05:16 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
Simple HTML question


<html>
<label>Name :</label><input name="username" type="text" size="20" maxlength="20"><br>
<label>Password :</label><input name="password" type="password" size="20" maxlength="20"><br>
</html>

In the above html fragment....what should I do so that the two input fields apear on the same vertical ident.....
 
Old 11-06-2005, 05:26 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Add a css style for label
PHP Code:
<style>
label {
    
displayinline;
    
floatleft;
    
width7em/* change this value to suit your needs */
    
margin-right1em;
}
</
style
 
Old 11-06-2005, 05:30 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Also you should specify what for label are, eg :
PHP Code:
<html>
<
label for="username">Name :</label>
<
input name="username" type="text" size="20" maxlength="20" /><br />
<
label for="password">Password :</label>
<
input name="password" type="password" size="20" maxlength="20" /><br />
</
html
 
Old 11-06-2005, 05:35 AM   #4
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
I just visited www.w3schools to learn about css...but I still have a question.. if I use the method in your first thread...wouldnt that just push all the text fields the same distance to the right leaving them still in a disordered fashion.

Another question, if I specify what the labels are for...would I benefit some function or does it just make my code clearer ?
 
Old 11-06-2005, 06:34 AM   #5
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Use tables.
Code:
<html>
<table>
<tr><td><label for="username">Name :</label></td>
  <td><input name="username" id="username" type="text" size="20" maxlength="20"></td></tr>
<tr><td><label for="password">Password :</label></td>
  <td><input name="password" id="username" type="password" size="20" maxlength="20"></td></tr>
</table>
</html>
 
Old 11-06-2005, 06:50 AM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Try set the width to a higher value just in case

More infos on the label tag here :
http://www.w3schools.com/tags/tag_la...p?output=print
 
Old 11-06-2005, 06:50 AM   #7
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Thanks spoon.........but keefaz hit the bulleye...that is exactly what i want ...now if someone could answer me about the label naming part
 
Old 11-06-2005, 06:57 AM   #8
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
See the link above, the for refers to the id of the input element
(and not the name which I believed)

When for is set to the id of the input element, when you click on the
text of the label, the input element is activated
 
Old 11-06-2005, 07:15 AM   #9
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
you mean if I disabled it first it will get enabled .....or do you mean that it gets focus ?

B.T.W Thanks for walkin the path with me keefaz
 
Old 11-06-2005, 07:19 AM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I mean that it gets focus, try the example on the link
 
Old 11-06-2005, 07:44 AM   #11
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Did that ...everything is fine now thanks for the support
 
Old 11-06-2005, 07:57 AM   #12
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Just one more question... if I want to increase the spacing btw lines in an html document what css code should I insert ?
 
Old 11-06-2005, 02:33 PM   #13
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You could set this for all the document with :
PHP Code:
body {
    
line-height4em;

Or for individual parts, in this case add line-height style for each tag you want to set
 
Old 11-07-2005, 02:19 AM   #14
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
That is smooth thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple PHP / HTML frames question Mq2004 Linux - Software 2 05-04-2005 10:36 AM
simple q: can you use php inside an html document? BrianK Programming 2 12-10-2004 09:31 PM
simple HTML question jayakrishnan Programming 0 03-20-2004 12:19 AM
Creating a simple html page from php? lucastic Linux - General 4 11-05-2003 08:48 AM
simple html browser tda Programming 5 05-20-2002 11:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration