Solved

Text alignment in form label

Posted on 2014-04-24
6
187 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 33

Assisted Solution

by:paulmacd
paulmacd 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 33

Expert Comment

by:paulmacd
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

762 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

18 Experts available now in Live!

Get 1:1 Help Now