Question

After an incredible amount of tinkering with CSS, I have managed to get my form elements to line up correctly. Unfortunately I cannot for the life of me figure out how to fix the labels/images from being positioned wrong. I want them to line up centered next to the select boxes, but they align at the top of it and nothing I have tried thus far has worked.

enter image description here

                <fieldset style="width:62%; float:left; margin-left: 19%;">

                        <label style="width: float: left;">Type</label>
                        <select style="width:40%; float: left;">
                            <option>Motherboard</option>
                            <option>Memory</option>
                            <option>Processor</option>
                        </select>

                        <label style="width:auto; float: left;">Item</label>
                        <select style="width:40%; float: left;">
                            <option>Motherboard</option>
                            <option>Memory</option>
                            <option>Processor</option>
                        </select>

                        <a href="#"><img src="images/icn_trash.png" style="width:auto; float: left;"></a>
                        <a href="#"><img src="images/icn_new_article.png" style="width:auto; float: left;"></a>

                </fieldset><div class="clear"></div>

Update

When changing it to use a Table instead, it appears as the following...

enter image description here

                    <div id="inv1" class="inventory" style="margin:0; padding:0;">
                        <fieldset style="width:62%; float:left; margin-left: 19%;">

                        <table style="width:100%">
                        <tr>

                            <td style="width:5%;"><label style="width:auto;">Type:</label></td>
                            <td><select style="width:100%;">
                                <option>Motherboard</option>
                                <option>Memory</option>
                                <option>Processor</option>
                            </select></td>

                            <td style="width:5%;"><label style="width:auto;">Item:</label></td>
                            <td><select style="width:100%;">
                                <option>Motherboard</option>
                                <option>Memory</option>
                                <option>Processor</option>
                            </select></td>

                            <td><a href="#"><img src="images/icn_trash.png" style="width:auto;"></a></td>
                            <td><a href="#" class="btnAddInventory"><img src="images/icn_new_article.png" style="width:auto;"></a></td>

                        </tr>
                        </table>

                        </fieldset><div class="clear"></div>
                    </div>
Was it helpful?

Solution 2

Here is a image when i'm using your html, is that right?

maybe you have another css which intersects with fields styles

OTHER TIPS

I suggest you to use table with 4 columns.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top