html - Table causes horizontal scrollbar to appear on mobile device -
my issue piece of code:
<form method="post" name="myform" class="donate-form"> <table class="donate-table"> <input type="hidden" name="cpp_header_image" value="logo.png"> <input type="hidden" name="on0" value="donation amount"> <tr> <th> <div class="check"> <input name="os0" type="radio" value="5.00" id="radio"> <label for="$5" id="textblock">$5.00</label> </div> </th> <th> <div class="checkboxgroup"> <input name="os0" type="radio" value="25.00" id="radio"> <label for="$25" id="textblock">$25.00</label> </div> </th> </tr> <tr> <th> <div class="checkboxgroup"> <input name="os0" type="radio" value="10.00" id="radio"> <label for="$10" id="textblock">$10.00</label> </div> </th> <th> <div class="checkboxgroup"> <input name="os0" type="radio" value="other" id="radio"> <label for="other" id="textblock">custom</label> </div> </th> </tr> </table>
the issue within table "donate-table" closer bottom. have 4 radio buttons, 5,10,25, , other, want these radio-buttons displayed in 2 rows 2 columns. on chrome (fullscreen) looks perfect no horizontal scroll bar , radio buttons looking okay when shrink window small possible or when use mobile device radio buttons cut off , on smartphone horizontal scrollbar appears (i know issue because of smaller screen size can't seem fix it) when delete 3 radio buttons , have 1 problem gone. how can fix can display 4 radio buttons without horizontal scrollbar appearing? have looked , tried overflow-x:hidden; , other suggested solutions none work. have fix? thank in advance.
here css code if needed:
.donations{ margin-top: 15%; overflow: hidden; } .checkboxgroup { text-align: center; display: inline-block; min-width: 150px; } .checkboxgroup label { display: inline-block; font-size: 20px; }
go through code comments
. hope you.
01. replace <th></th> <td></td>
02. /* use .donate-table instead of .donations */
03. /* move min-height property parent class (means .donate-table class) */
/* use .donate-table instead of .donations */ .donate-table{ margin-top: 15%; overflow: hidden; width:100%; min-width:160px; max-width:500px; } /* move min-height property parent class (means .donate-table class) */ .checkboxgroup { display: inline-block; } .checkboxgroup label { display: inline-block; }
<form method="post" name="myform" class="donate-form"> <table class="donate-table"> <input type="hidden" name="cpp_header_image" value="logo.png"> <input type="hidden" name="on0" value="donation amount"> <tr> <td> <!-- replace <th></th> <td></td> --> <div class="check"> <input name="os0" type="radio" value="5.00" id="radio"> <label for="$5" id="textblock">$5.00</label> </div> </td> <td> <div class="checkboxgroup"> <input name="os0" type="radio" value="25.00" id="radio"> <label for="$25" id="textblock">$25.00</label> </div> </td> </tr> <tr> <td> <div class="checkboxgroup"> <input name="os0" type="radio" value="10.00" id="radio"> <label for="$10" id="textblock">$10.00</label> </div> </td> <td> <div class="checkboxgroup"> <input name="os0" type="radio" value="other" id="radio"> <label for="other" id="textblock">custom</label> </div> </td> </tr> </table>
Comments
Post a Comment