Can I set up tab stops in html5?

后端 未结 6 1572
北海茫月
北海茫月 2021-02-13 03:10

I would like to set up tab stops in html5 and be able to align text to them, just like in Word. For my application I can\'t use tables. Is there a way to do this? Do I have t

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-13 03:45

    Actually, I had a similar situation, and I did it quite simply. Use the within the

    property, and float it appropriately.

    css:

    p.main-text { /* these properties don't matter much */    
        margin: 0;    
        text-indent: 0;    
        font-size: 1em;    
        line-height: 1.2;    
        text-align:justify;    
    }    
    span.column-width { /*this defines the width of the first column */    
        width: 33%;    
        float: left;    
    }
    

    html:

    Diary Date: 2016 April 01 —This is the text of the diary entry. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean fringilla pharetra metus id blandit. Integer molestie sed mauris eget gravida. Fusce aliquam diam eu arcu imperdiet vehicula. Fusce fermentum molestie aliquet. Phasellus sodales, mauris sed ornare accumsan, dolor ligula vehicula magna, vel pulvinar sapien lorem condimentum purus. Etiam vulputate commodo mattis. Etiam non tincidunt leo, eget ultricies mauris. Fusce rhoncus ultrices purus. Nunc id scelerisque nisi, quis congue turpis.

    fiddle: http://jsfiddle.net/Q3ruh/44/

提交回复
热议问题