css h1 - only as wide as the text

前端 未结 9 483
情深已故
情深已故 2020-12-24 00:08

I have an H1 style for my site:

.centercol h1 {
    color: #006bb6;
    font-weight: normal;
    font-size: 18px;
    padding:3px 3px 3px 6px;
    border-lef         


        
9条回答
  •  轮回少年
    2020-12-24 00:56

    You can use the inline-block value for display, however in this case you will loose the block feature of h1 i.e. the siblings will be displayed inline with h1 if they are inline elements(in which case you can use a line-break
    ).

    display:inline-block; 
    

提交回复
热议问题