How do I hide the borders around checkboxes in an ASP.Net CheckBoxList control with jQuery?

前端 未结 2 1594
你的背包
你的背包 2021-01-19 12:11

I need to get rid of the borders around the individual checkboxes that are rendered by a CheckBox control. Here\'s what it looks like now:

2条回答
  •  自闭症患者
    2021-01-19 12:29

    The problem isn't the input but in it's td. Look:

    
    

    Here (above) is defined the border radius. And here (below) the border color:

    .formTable tr, .formTable tr td, .formTable tr th
    {
        background-color: #eeeeee;
        padding: 3px;
        border: solid 1px #bbbbbb;
        vertical-align: top;
    }
    

    So, to change this, you may want to add just after the above CSS code, this:

    .formTable tr td
    {
        border:0;
    }
    

    Doing this, you'll just make the td borders to disappear and not the borders of tr or th

    UPDATE AFTER OP's CLARIFICATIONS

    Oh, all right. Now with those new screenshots we can see well what you're tryning to do achieve. Anyway, you're still trying to remove a border from the input, but I repeat, the problem isn't the input but it's td.

    I'll explain you with the code you gave us ok? So:

    
          ...
        

    This is the HTML code of the table that has inside all those checkboxes. All it's TDs have rounded borders and stuff we already know. This table that has inside all those checkboxes is inside a bigger TD (which borders you want to keep) W're in the following situation:

    Table TDs

    So now you got 2 ways to act without changing all your HTML: CSS or jQuery.

    The CSS way

    Pretty simple, you may want to put inline style at those table cells (which have checkboxes inside) like this: style="border:0" instead of style="border-top-left-radius:5px; border-top-right-radius:5px; border-bottom-left-radius:5px; border-bottom-right-radius:5px;". Or Just create a new CSS class like this

    .no-borders {
        border:0;
    }
    

    and apply it on every td you don't want to see.

    The jQuery way

    
    

提交回复
热议问题