Solved

Text alignment in form label

Posted on 2014-04-24
6
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 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