How can I change the thickness of my
tag

前端 未结 9 1126
迷失自我
迷失自我 2020-12-22 17:07

I want to change the thickness of my horizontal rule (


)in CSS. I know it can be done in HTML like so -


相关标签:
9条回答
  • 2020-12-22 18:03

    I would recommend setting the HR itself to be 0px high and use its border to be visible instead. I have noticed that when you zoom in and out (ctrl + mouse wheel) the thickness of HR itself changes, while when you set the border it always stays the same:

    hr {
        height: 0px;
        border: none;
        border-top: 1px solid black;
    }
    
    0 讨论(0)
  • 2020-12-22 18:03

    I believe the best achievement for styling <hr> tag is as follow:

    hr {
    color:#ffffd;
    background-color:
    #ffffd; height:1px;
    border:none;
    max-width:100%;
    }
    

    And for the HTML code just add: <hr>.

    0 讨论(0)
  • 2020-12-22 18:05

    I was looking for shortest way to draw an 1px line, as whole load of separated CSS is not the fastest or shortest solution.

    Up to HTML5, the WAS a shorter way for 1px hr: <hr noshade> but.. The noshade attribute of <hr> is not supported in HTML5. Use CSS instead. (nor other attibutes used before, as size, width, align)...


    Now, this one is quite tricky, but works well if most simple 1px hr needed:

    Variation 1, BLACK hr: (best solution for black)

    <hr style="border-bottom: 0px">
    

    Output: FF, Opera - black / Safari - dark gray


    Variation 2, GRAY hr (shortest!):

    <hr style="border-top: 0px">
    

    Output: Opera - dark gray / FF - gray / Safari - light gray


    Variation 3, COLOR as desired:

    <hr style="border: none; border-bottom: 1px solid red;">
    

    Output: Opera / FF / Safari : 1px red.

    0 讨论(0)
提交回复
热议问题