Solved

Text alignment in form label

Posted on 2014-04-24
6
188 Views
Last Modified: 2014-04-24
I am an amateur at CSS.  There is a contact form at www.mauivacationrental.com/contact.htm with form field labels.  I thought I established a right-alignment for those labels in styling on that page, but "City" and "Country" labels appear to be left-aligned.  Please advise.
0
Comment
Question by:ddantes
  • 2
  • 2
  • 2
6 Comments
 
LVL 34

Assisted Solution

by:Paul MacDonald
Paul MacDonald earned 125 total points
ID: 40021127
Change...

City:
<input type="text" class="fullfld" style="margin-left:47px; margin-right:60px" maxlength="30" name="City">

...and...

Country:
<input type="text" class="fullfld" style="margin-left:20px; margin-right:20px" maxlength="15" name="Country">

...to...

City:
<input type="text" class="fullfld" style="margin-right:60px;" maxlength="30" name="City">

...and...

Country:
<input type="text" class="fullfld" style="margin-right:20px;" maxlength="15" name="Country">
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 125 total points
ID: 40021162
Your issue is you have your input inside a P tag and the input you have inline style for margin-left.  Take out the margin left and you are kind of good.

<input type="text" class="fullfld" style="margin-left:47px; margin-right:60px" maxlength="30" name="City">

Open in new window



Using a <label>something</label><input name=..> would be better though.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 40021174
I got it backwards up above.  Change...

City:
<input type="text" class="fullfld" style="margin-left:47px; margin-right:60px" maxlength="30" name="City">

...and...

Country:
<input type="text" class="fullfld" style="margin-left:20px; margin-right:20px" maxlength="15" name="Country">


...to...

City:
<input type="text" class="fullfld" style="margin-left:47px;" maxlength="30" name="City">

...and...

Country:
<input type="text" class="fullfld" style="margin-left:20px;" maxlength="15" name="Country">
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Closing Comment

by:ddantes
ID: 40021635
Thanks to you both.   When there are nested components, it's difficult for me to keep track of which element is being styled.  It worked to remove of the left margin from "fullfld", which created a gap between the label and the text field, and insert a left margin in the required "formlabel" elements so that things line up.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40021643
Try and avoid styling inline and use css instead.  Otherwise when you try and style using css, the inline takes precedent.
0
 

Author Comment

by:ddantes
ID: 40021644
That's good advice, thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now