1

I need a CSS calc alternative for browsers (like the default Android browser) that don't support it to define dynamically the width of input text fields, leaving at right only a space for the submit button.

My actual CSS code:

div .feedburner form input[type=text] {
    width: calc(100% - 76px);
}

I tried this, adapted from here, but without success:

div .feedburner form input[type=text] {
    /** width: calc(100% - 76px); */
    padding-right: 76px;
    width: 100%;
}
Community
  • 1
  • 1
Yurié
  • 2,148
  • 3
  • 23
  • 40

1 Answers1

2

In some situations you can use a trick with an invisible border and border-box sizing model

.calc .content {
    background: red;
    height: 250px;
}
.noCalc .content {
    background: green;
    height: 250px;
}
.calc {  
    width: calc(100% - 100px);
}
.noCalc {
    box-sizing: border-box;
    width: 100%;
    border-right: 100px solid transparent;
}
<div class="calc">
  <div  class="content">CALC</div>
</div>
<div class="noCalc">
  <div  class="content">NO CALC</div>
</div>
rm-vanda
  • 3,122
  • 3
  • 23
  • 34
ben
  • 3,558
  • 1
  • 15
  • 28