Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2007, 01:45 AM
Authorized User
 
Join Date: Feb 2007
Location: Hyderabad, Andhra Pradesh, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Align to right not working

I designed below this form.
<form id="frmlgn" action="">
  <label for="username">Username:</label>
  <input id="username" name="" type="text" class="textBox" size="15" />
  &nbsp;&nbsp;
  <label for="pwd">Password:</label>
  <input id="pwd" name="" type="password" class="textBox" size="15" />
  &nbsp;&nbsp;
  <input name="" type="button" value="Login" class="buttonStyle" />
  <br />
  <a href="#" class="alignright">Forgot Password?</a>
</form>

This form is controlled through a CSS class file. Here is the class details:
#frmlgn{
float:right;
margin-bottom:20px;
}

The problem in browser is, the Forgot Password link aligns to left. I used a class to align it to right, that is not working. Can anybody help to fix it?

Shivanand Yerva
__________________
Shivanand
Reply With Quote
  #2 (permalink)  
Old June 4th, 2007, 08:51 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Although I would do a bit different from that, to avoid messing up with your code, here's my suggestion:

Instead of using "<br />" to break the line, put the link inside of a div and align the contents of this div on the right.

In other words, use the same code above and just delete the <br> tag and replace the next line for: <div class="alignright"><a href="#">Forgot Password?</a></div>

Of course, you'd have to add the class:
.alignright {
text-align:right;
}

This will do the job.

Reply With Quote
  #3 (permalink)  
Old June 5th, 2007, 12:48 AM
Authorized User
 
Join Date: Feb 2007
Location: Hyderabad, Andhra Pradesh, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks PauloAmado. You mentioned that you will do it differntly, let me know what is that approach.

Shivanand Yerva
Reply With Quote
  #4 (permalink)  
Old June 5th, 2007, 02:46 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nothing wrong with your approach, Shiva. Actually, I find it pretty clean. When I said I would do different, I really meant "I have done differently before", but, of course, that will depend highly on the other elements of the page and the design you chose. Good luck with your work.

Reply With Quote
  #5 (permalink)  
Old July 19th, 2007, 01:49 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

There is one thing I would do differently. alignright is a functional classname, it describes what you are trying to do to the element. I'd use a descriptive class name, one that describes what the element is, like class="forgotPassword". Otherwise, when you change your mind later (or your client changes your mind for you ), all of a sudden your CSS has things like

.alignright {
text-align:left
}

Worse, when you look at your XHTML code it's actually lying to you, because now it's not aligned to the right at all.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EASY Q: Left-Align and Right-Align DIV? panuvin ASP.NET 1.0 and 1.1 Basics 0 December 16th, 2006 02:02 AM
Textbox align surendran Java GUI 2 August 24th, 2004 07:54 AM
align=right? larry Javascript How-To 11 July 6th, 2004 05:07 PM
Align text acko ASP.NET 1.x and 2.0 Application Design 2 January 9th, 2004 10:21 AM
align Center melvik C# 1 September 7th, 2003 04:50 AM



All times are GMT -4. The time now is 07:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.