Hide check radio button with css

前端 未结 7 878
一向
一向 2020-12-25 13:00

I would like to know if it is possible to hide the checked radio button with css by using:

  { display:none; }

I don\'t know how to address

7条回答
  •  眼角桃花
    2020-12-25 13:49

    If you have used {display:none;} and you still see a space (like 3px or so), then it is likely that you have spaces or new-lines between the elements in your html that can sometimes cause the renderer to display some pixles between those elements.

    This is indeed problematic and can be very difficult to identify as the problem without this knowledge, but once you know, you have two easy solutions:

    1. Either, remove that white space between your tags in your html. (Unfortunately, that makes your html messier, so the second option may be better.)

    2. Or, in your css, set the font-size in the parent container to 0px. ex: #parent{font-size:0px;} and then initialize it again for all the children of the parent with #parent *{font-size:initial;}.

    #parent{
      font-size:0px;
      display:block;
    }
    #parent *{
      font-size:initial;
    }
    .tab-label {
      display:inline-block;
      background: #eee; 
      border: 1px solid; 
    }
    [name="tab-group-1"] {
      display: none;  
    }

提交回复
热议问题