首页 > 解决方案 > How can I make horizontal scroll bar only code block in ?

问题描述

I'm trying to make some custom table with HTML and SASS. I searched many questions on this site, but none of them works for my case.

the properties of the table are:

I've already done with:

table-layout: fixed

: It works partially. But the column widths are divided equally across the table, regardless of content inside the cells. I need a responsive column. (If you activate the line 10 of SASS in my demo below, you can see what I said.)

overflow-x: scroll, auto, ...

: I succeeded to make scroll bar in the code block. But the width of the table exceeds the 'width: 100%'. In other words, the width of (which has the code block) stretches unlimitedly. (This is demonstrated in my the demo below.)

here is my demo: http://jsfiddle.net/purhvf0b/23/

标签: htmlcsssass

解决方案


add the below sass to td

 td
    border: 1px solid #444444
    width: 1px

also add the below sass to third column (I have added a class longtd to third td)

.longtd
  overflow: auto
  max-width: 0;
  width: auto;

forked fiddle http://jsfiddle.net/Soothran/n57m0f1b/

http://jsfiddle.net/lalji1051/ty4gof03/


推荐阅读