html - 如何设置输入标签的宽度100%

标签 html css

我在他旁边有输入标签我有小图标,现在我不想将输入标签宽度设置为 100%,并且在不同的屏幕上适合显示,但我不能尝试使用 css 技巧 < strong>计算

宽度:calc(100%-100px) !important;

http://jsfiddle.net/p0s8yad7/

HTML

<div class="one-row-location">
        <label class="item item-input location-input">

          <input  class="input-label inputlocation" type="text" name="geolocation" id="geolocation" placeholder="Lokation" value="">
        </label><div class="location-icon">
    <img src="http://oi62.tinypic.com/10ng7b5.jpg">
        </div>

CSS

.one-row-location{
    margin-bottom:20px;
    margin-right:20px;
    margin-left:20px;
}
.item-input{
    padding:0;
    background-color:#fff ! important;
    margin-bottom:20px;
    margin-left:20px;
    margin-right:20px;

  ! important;

}

.item-input .input-label{
    font-size:14px;
    color:#99999f;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight:300;
    font-style: italic;

}
.input-label{
    padding-right: 4px ! important;
    word-wrap: break-word;
        width:calc(100%-100px) !important;
}

最佳答案

我相信这就是作者的要求: http://jsfiddle.net/p0s8yad7/3/

HTML

<div class="one-row-location">
<div class="location-icon"><img src="http://oi62.tinypic.com/10ng7b5.jpg"></div>
      <div class="location-field"><input  class="input-label inputlocation" type="text" name="geolocation" id="geolocation" placeholder="Lokation" value="" />
    </div>

和 CSS

    .one-row-location {
  width: 80%;  // For demonstartion purposes - this width can be whatever is needed
  display: table;
}
.location-field{
    display: table-cell;
    width: 100%;
    vertical-align: top;
}
.inputlocation{
    font-size:14px;
    color:#99999f;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight:300;
    font-style: italic;
    height:27px;
    width:100%;
    margin-left: 0px;
}
.location-icon {
    display: table-cell;
    width: 29px;
    height:33px;
}

关于html - 如何设置输入标签的宽度100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31928670/

相关文章:

html - 为什么这些跨度的高度呈现不同?

python - 使用 Python 读取 .htm 文件时的编码问题

html - SVG 屏蔽一个元素

html - flex 容器内的 flex-wrap 元素不会使容器的宽度变大

html - Ruby Slim - 如何使用 Rails 助手或变量定义元素的类?

css - 将单选按钮的标签放在按钮旁边

jquery - Webfont 在某些窗口大小下被截断

html - 推特 Bootstrap : Same height for grid

html - 为什么显示:inline affect children using position:sticky?

CSS 将 Div 标签放在页面顶部,没有空格