0

I have below html page:

jsfiddle

<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Extended UI</title> <style type="text/css"> .header{ padding-right:50px; } .value{ padding-left:50px; } </style> </head> <body> <div id="wrapper"> <div id="score"><span class="header">Score:</span><span class="value">10</span></div> <div id="dd-1"><span class="header">Has Account</span><span class="value"><select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select></span></div> <div id="dd-2"><span class="header">Has House</span><span class="value"><select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select></span></div> <div id="dd-3"><span class="header">Has Phone</span><span class="value"><select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select></span></div> </div> </body> </html> 

All the values are not displayed in order. How can i bring all the values order properly?

Thanks!

1
  • Order means, Are you talking about indentation and postion? Commented Feb 21, 2014 at 11:30

4 Answers 4

1

You are applying padding to the inline element so it won't replicate your change first of all you have to make it display:inline-block and then specify width per your structure

Fiddle: http://jsfiddle.net/HarishBoke/8HgHe/

Sign up to request clarification or add additional context in comments.

2 Comments

Why so complicated, can be done with only one selector
yeah, we can achieve with tag selector also, but i intentionally define with classes, as per his structure
0

Working Demo is here Jsfiddle

Here is the Css changes you have to

.header{ padding-right: 50px; min-width: 120px; display: inline-block; } .value{ padding-left:50px; display: inline-block; } 

Comments

0

How about using a simple table?

<table> <tr> <td>Score:</td> <td>10</td> </tr> <tr> <td>Has Account:</td> <td> <select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select> </td> </tr> <tr> <td>Has House:</td> <td> <select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select> </td> </tr> <tr> <td>Has Phone:</td> <td> <select name="" id=""> <option value="">Yes</option> <option value="">No</option> </select> </td> </tr> </table> 

FIDDLE

Comments

0

You can't set with for inline elements, but inline-block will work for you.

.header { display: inline-block; width: 150px; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.