简体   繁体   中英

how to display three text fields on one line

I am trying to display three textfields on one line. When screen is smaller then these textfields should be displayed in the same line. Currently when I make my browser smaller then textfields move to the second line.

How can I achieve this?

please see my code

<div class="fields">
    <input type="text" class="name" />
    <span>&ndash;</span>
    <input type="text" class="name" />
    <input type="text" class="name2" />
</div>

.fields {
    border: 1px solid grey;
    width: 23%;
}
.name {
    display: inline;
    width: 11ex;
}
.name2 {
    display: inline;
    width: 8ex;
}

Give white-space:nowrap; to your .fields DIV. Write like this:

.fields {
            border: 1px solid grey;
            width: 23%;
            white-space:nowrap;
        }

Check this http://jsfiddle.net/6tkF8/1/

This solves your issue:

.fields {
  display: inline;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM