How to fix position of html element label with css?

robson

I'm fighting with my html skin. It is based on primefaces. But there is one problem - that select component is not in the same line in toolbar.

HTML CODE:

<div class="ui-toolbar ui-widget ui-widget-header ui-corner-all ui-helper-clearfix" id="fStats:stats10Toolbar">
    <div class="ui-toolbar-group-left">Company name: 
        <span class="ui-autocomplete" id="fStats:company10">
            <input type="text" value="" autocomplete="off" class="ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all"/>
        </span>
        <img width="20" height="20" src="/javax.faces.resource/spacer/dot_clear.gif.xhtml?ln=primefaces&amp;v=5.0" alt="" />
        Employee name: 
        <span class="ui-autocomplete">
            <input type="text" value="  " autocomplete="off" class="ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all"/>
            <input type="hidden" autocomplete="off"/>
        </span>
        <img width="20" height="20" src="/javax.faces.resource/spacer/dot_clear.gif.xhtml?ln=primefaces&amp;v=5.0" alt=""/>
        Phase select:
        <div class="ui-selectonemenu ui-widget ui-state-default ui-corner-all" style="width: 48px; bottom: 0px;">
            <div class="ui-helper-hidden-accessible">
                <select tabindex="-1" name="fStats:j_idt1283_input">
                    <option value=""></option>
                    <option value="A">A*</option>
                    <option value="B">B*</option>
                    <option value="C">C</option>
                </select>
            </div>
            <div class="ui-helper-hidden-accessible">
                <input type="text" readonly="readonly"/>
            </div>
            <label class="ui-selectonemenu-label ui-inputfield ui-corner-all" style="width: 32px;">C</label>
            <div class="ui-selectonemenu-trigger ui-state-default ui-corner-right">
                <span class="ui-icon ui-icon-triangle-1-s ui-c"></span>
            </div></div>
        <img width="20" height="20" src="/javax.faces.resource/spacer/dot_clear.gif.xhtml?ln=primefaces&amp;v=5.0" alt=""/>
        <button type="submit"  class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
            <span class="ui-button-text ui-c">Generuj</span>
        </button>
    </div>
</div>

CSS:

.ui-helper-clearfix:after {
    clear: both;
    content: ".";
    display: block;
    height: 0;
    visibility: hidden;
}

.ui-toolbar {
    padding: 0.2em;
    position: relative;
}

.ui-toolbar-group-left {
    float: left;
}

.ui-widget-header {
    background: none repeat scroll 0 0 #424548;
    border: 1px solid #56585c;
    color: #f9f7f7;
    font-weight: bold;
}
.ui-helper-clearfix {
    display: block;
}

.ui-autocomplete {
    white-space: nowrap;
    box-shadow: none;
    cursor: pointer;
    display: inline-block;
    position: relative;
    width: auto;
}

.ui-selectonemenu {
    cursor: pointer;
    display: inline-block;
    position: relative;
    width: auto;
}
.ui-corner-all {
    border-radius: 4px;
}

.ui-helper-hidden-accessible {
    border: 0 none;
    clip: rect(0px, 0px, 0px, 0px);
    height: 0;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 0;
}

.ui-selectonemenu .ui-selectonemenu-label {
    border: medium none;
    display: block;
    font-weight: normal;
    overflow: hidden;
    text-align: left;
    white-space: nowrap;
    width: 100%;
}

If you will see my jsfiddle, you'll understand: http://jsfiddle.net/bv3pz8h6/

There is toolbar and select component with currently selected "C". But the "C" is like aligned to top. I can see that if I remove overflow:hidden from .ui-selectonemenu .ui-selectonemenu-label class - the component is inline, but it makes other problems when text is longer than component.

Experts, is there other way to place "C" inline? Thanks for any hints.

chrisc

Set the vertical-align property of '.ui-selectonemenu' to 'text-top'.

.ui-selectonemenu {
    cursor: pointer;
    display: inline-block;
    position: relative;
    width: auto;
    vertical-align:text-top;
}

In the '.ui-selectonemenu .ui-selectonemenu-label' selector you can set the line-height property to 1em. This value represents the current font size.

.ui-selectonemenu .ui-selectonemenu-label {
    border: medium none;
    display: block;
    font-weight: normal;
    overflow: hidden;
    text-align: left;
    white-space: nowrap;
    width: 100%;
    line-height: 1em;
}

See this updated fiddle: http://jsfiddle.net/bv3pz8h6/11/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to position label text with css

From Dev

How to position label text with css

From Dev

How to fix the position of an element in drag and drop - Angular

From Dev

CSS How to fix element position after some scroll without using jquery

From Dev

Best practice to position html element using css

From Dev

Best practice to position html element using css

From Dev

HTML/CSS: how to position forms?

From Dev

How to select text between html <label> element

From Dev

How can I fix the css for this element?

From Dev

Position HTML element relative to bottom of parent element using CSS?

From Dev

Position HTML element relative to bottom of parent element using CSS?

From Dev

how to change element CSS position with animation

From Dev

how to change element CSS position with animation

From Dev

How to fix the position of an absolute overflowing element with respect to a relative parent?

From Dev

How to fix every element on the same position, when browser is resized?

From Dev

How to add label to percentage bar in css and html?

From Dev

How to get position information of HTML element

From Dev

How to position a html element under a fixed div

From Dev

How to get the scroll position of an HTML element in a table?

From Dev

How to position a label using css relative to an absolute positioned input box

From Dev

How to Position a CSS Element on the page? Without position properties?

From Dev

how distanciate element css, html

From Dev

CSS Position relative goes over fixed how to fix this?

From Dev

How to fix the position of arc on a circular border after animation in css

From Dev

Is HTML label a replaced element?

From Dev

How fix position element so that while hovering on one element other two element should remain at same place

From Dev

How fix position element so that while hovering on one element other two element should remain at same place

From Dev

How to position HTML code over CSS

From Dev

how to position a search bar in html/css

Related Related

  1. 1

    How to position label text with css

  2. 2

    How to position label text with css

  3. 3

    How to fix the position of an element in drag and drop - Angular

  4. 4

    CSS How to fix element position after some scroll without using jquery

  5. 5

    Best practice to position html element using css

  6. 6

    Best practice to position html element using css

  7. 7

    HTML/CSS: how to position forms?

  8. 8

    How to select text between html <label> element

  9. 9

    How can I fix the css for this element?

  10. 10

    Position HTML element relative to bottom of parent element using CSS?

  11. 11

    Position HTML element relative to bottom of parent element using CSS?

  12. 12

    how to change element CSS position with animation

  13. 13

    how to change element CSS position with animation

  14. 14

    How to fix the position of an absolute overflowing element with respect to a relative parent?

  15. 15

    How to fix every element on the same position, when browser is resized?

  16. 16

    How to add label to percentage bar in css and html?

  17. 17

    How to get position information of HTML element

  18. 18

    How to position a html element under a fixed div

  19. 19

    How to get the scroll position of an HTML element in a table?

  20. 20

    How to position a label using css relative to an absolute positioned input box

  21. 21

    How to Position a CSS Element on the page? Without position properties?

  22. 22

    how distanciate element css, html

  23. 23

    CSS Position relative goes over fixed how to fix this?

  24. 24

    How to fix the position of arc on a circular border after animation in css

  25. 25

    Is HTML label a replaced element?

  26. 26

    How fix position element so that while hovering on one element other two element should remain at same place

  27. 27

    How fix position element so that while hovering on one element other two element should remain at same place

  28. 28

    How to position HTML code over CSS

  29. 29

    how to position a search bar in html/css

HotTag

Archive