css - How to disable horizontal scroll and shrink the size of elements on mobile view? -


i using material-ui project. right have lot of anchor elements displaying table within paper component mui. because table long, generates horizontal scroll bar in mobile view not want. i'm wondering there way shrink width of table-like anchor elements horizontal scroll bar won't appear? (i don't want use overflow-x: hidden hide elements)

a simplified version of code:

class row extends react.component {   render() {     const cell = (<a class="linkcell" key={cell.id} href="#"></a>);       const row = [];     (let = 0; < 20; i++) {       row.push(cell);     }     return <div>{row}</div>   } }  class wholetable extends react.component {     render() {   const row = <row key={row.id}/>   const table = [];   (let = 0; < 100; i++) {     table.push(row);   }   return <paper>{table}</paper>     }; } 

what looks (before , after horizontal scrolling): before scrolling horizontally

after scrolling horizontally

any appreciated!

in css file, use

width: 100vw; 

in elements, shrink them 100% width of viewport. you'll have careful if use padding, you'll have subtract pixels width.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -