text wrapping incorrectly for radio button

后端 未结 4 1426
梦毁少年i
梦毁少年i 2021-02-13 05:55

I have 2 html radio buttons (separated by
tags) where the text is wrapping under the radio button instead of aligning with the left in

4条回答
  •  再見小時候
    2021-02-13 06:13

    First of all, the use of a
    is generally not recommended, it's a lot better to try and use the margin CSS property to create space between elements.

    It's also best in this situation to use CSS to do what you want to do. This is because by default those elements won't have this kind of behaviour.

    In this case you would want something that looks like this:

    Some text that is too long to fit inline and must be broken up over multiple lines.Some text that is too long to fit inline and must be broken up over multiple lines.Some text that is too long to fit inline and must be broken up over multiple lines.
    //this is important for repeated inputs

    And then your CSS would look like this:

    .radioLeft
    {
       float: left;
    }
    
    .textBlock
    {
        float: left;
        width: 80%; //Adjust this value to fit
    }
    

提交回复
热议问题