[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Text alignment in form label

Posted on 2014-04-24
6
Medium Priority
?
197 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 500 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 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 54

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses
Course of the Month17 days, 14 hours left to enroll

831 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