Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-07-2012, 11:44 PM   PM User | #1
lesponce
New Coder

 
Join Date: Jul 2012
Posts: 49
Thanks: 17
Thanked 1 Time in 1 Post
lesponce is an unknown quantity at this point
Borders or Frames within Text and Fields

I'm trying to add borders to a section of my input fields.


__ Hello _____________________
| |
| Hello: Input Field Here |
| Hello: Input Field Here |
| |
____________________________|

Lines are not straight, but you get the picture. How do I accomplish this?
Thank you.
lesponce is offline   Reply With Quote
Old 09-08-2012, 12:06 AM   PM User | #2
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
you mean a <fieldset> and <legend> tag?

The <fieldset> adds the borders automatically, the <legend> places it nicely between the borders.
Code:
<form>
     <fieldset>
          <legend>Personalia:</legend>
          Name: <input type="text" /><br />
          Email: <input type="text" /><br />
          Date of birth: <input type="text" />
     </fieldset>
</form>
http://www.w3schools.com/tags/tag_legend.asp (click the "try it yourself" button to see what it looks like)

Last edited by Sammy12; 09-08-2012 at 12:08 AM..
Sammy12 is offline   Reply With Quote
Users who have thanked Sammy12 for this post:
lesponce (09-08-2012)
Old 09-08-2012, 12:21 AM   PM User | #3
lesponce
New Coder

 
Join Date: Jul 2012
Posts: 49
Thanks: 17
Thanked 1 Time in 1 Post
lesponce is an unknown quantity at this point
Yes, that's what I needed. Thank you.
lesponce is offline   Reply With Quote
Old 09-08-2012, 12:25 AM   PM User | #4
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
A word of caution, I believe it renders differently in various browsers.
Don't quote me on that, but keep it in the back of your head.
Sammy12 is offline   Reply With Quote
Users who have thanked Sammy12 for this post:
lesponce (09-08-2012)
Old 09-08-2012, 12:28 AM   PM User | #5
lesponce
New Coder

 
Join Date: Jul 2012
Posts: 49
Thanks: 17
Thanked 1 Time in 1 Post
lesponce is an unknown quantity at this point
Thanks. I will add this code to an ASP.NET web page.

How do I align the fields to

First: blankspace XXXXXX
Last: blankspace XXXXXX
Date of Birth.......XXXXXX

instead of:
First: XXXXXX
Last: XXXXXX
Date of Birth: XXXXXX

Thx a million!

Last edited by lesponce; 09-08-2012 at 12:32 AM..
lesponce is offline   Reply With Quote
Old 09-08-2012, 12:34 AM   PM User | #6
Sammy12
Registered User

 
Join Date: Jun 2011
Posts: 1,063
Thanks: 12
Thanked 241 Times in 240 Posts
Sammy12 is on a distinguished road
Code:
label {
     display: inline-block;
     width: 100px;
}
Code:
<form>
     <fieldset>
          <legend>Personalia:</legend>
          <label>Name:</label> <input type="text" /><br />
          <label>Email:</label> <input type="text" /><br />
          <label>Date of birth:</label> <input type="text" />
     </fieldset>
</form>
EDIT: Just fixed a <label> tag, I was missing a "/". It is working correctly now.

Last edited by Sammy12; 09-08-2012 at 12:37 AM..
Sammy12 is offline   Reply With Quote
Users who have thanked Sammy12 for this post:
lesponce (09-08-2012)
Old 09-08-2012, 01:01 AM   PM User | #7
lesponce
New Coder

 
Join Date: Jul 2012
Posts: 49
Thanks: 17
Thanked 1 Time in 1 Post
lesponce is an unknown quantity at this point
Awesome! Thanks a lot!!
lesponce is offline   Reply With Quote
Reply

Bookmarks

Tags
html

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Advertisement
Log in to turn off these ads.