Solved

Need help styling my column two columns of data. I am using CSS with html markup

Posted on 2013-01-14
2
270 Views
Last Modified: 2013-01-15
Hello, I have an Asp.net MVC .form "cshtml". I am using the fieldset command with a little bit of css markup to style the page. The css is only about 6 lines of css markup.

basically I want a label on the left side of my form, followed by a control such as a textbox, middle initial or last name on the right side of the label. Below is a visual representation of what I mean.

First Name               [______________]
Middle Initial           [____]
Last Name                [_______________]
Phone                       [_______________]

Something is terribly wrong though, because the left most column data is not wide enough, and the labels are being broken and printed on the next line. Can someone tell me how to fix my CSS so that I get left and right column data, with the columns aligned? I tried to increase the left most column, by setting the "width" attribute. Below is the CSS I am using. Attached is my markup of my web form, which I am trying to style. I would really appreciate some help.

 .fixwidthlabelLeft
{
    margin: 5px;
    height: 20px;
    width: 150px;
    float:left;
}
cshtmlCode.txt
0
Comment
Question by:brgdotnet
[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 Comments
 
LVL 16

Accepted Solution

by:
Kamal Khaleefa earned 50 total points
ID: 38777099
hi

try to create a table like this
<table>
<tr>
<td width="20%">your text</td>
<td align="left"> your field</td>
</tr>


 

 
 
</table>
0
 
LVL 30

Assisted Solution

by:LZ1
LZ1 earned 230 total points
ID: 38778486
You can use a table. You could also use just CSS.

Try this:
p{float:left;clear:both;}
.fixwidthlabelLeft
{
    margin: 5px;
    height: 20px;
    /*width: 150px;*/
    float:left;
} 
input{float:right;clear:right;margin-left:20px;}

Open in new window

0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
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…
Suggested Courses

617 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