How to insert spaces/tabs in text using HTML/CSS

后端 未结 18 2682
死守一世寂寞
死守一世寂寞 2020-11-28 01:20

Possible ways:

 ... 

or

style=\"white-space:pre\"

Anything else?

18条回答
  •  悲哀的现实
    2020-11-28 02:11

    Use the standard CSS tab-size.

    To insert a tab symbol (if standard tab key, move cursor) press Alt + 0 + 0 + 9

    .element {
        -moz-tab-size: 4;
        tab-size: 4;
    }
    

    My preferred:

    *{-moz-tab-size: 1; tab-size: 1;}
    

    Look at snippet or quick found example at tab-size.

    .t1{
        -moz-tab-size: 1;
        tab-size: 1;
    }
    .t2{
        -moz-tab-size: 2;
        tab-size: 2;
    }
    .t4{
        -moz-tab-size: 4;
        tab-size: 4;
    }
    pre {border: 1px dotted;}

    tab = {default} space

    	one tab text
    		two tab text
    

    tab = 1 space

    	one tab text
    		two tab text
    

    tab = 2 space

    	one tab text
    		two tab text
    

    tab = 4 space

    	one tab text
    		two tab text
    

提交回复
热议问题