Rajeev
Rajeev

Reputation: 1371

CSS style=display:block not working

Browser is Firefox.

I have a list of 15 radio buttons. After displaying them like this:

<div class="abcd"  style="margin-left:10px;">
    <form id='some'....>
        <legend>Select Item type :</legend>
        <fieldset style="display:block;float:left;">
            <input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC
            ...
        </fieldset>
        <p>
            <input placeholder="Enter Name/Value" name="xxx" id="xxx" size="40" style="display:block;float:left;">
            <button type="button" id="xxx" style="width:100;">Process</button>
        </p>
    </form>
</div>

Everything is displaying in one line. I am not sure how to display the textbox under radio buttons with some space in between.?

pl help.

Upvotes: 12

Views: 52044

Answers (4)

JohnFromMiami
JohnFromMiami

Reputation: 83

When using the float attribute you have to clear it so that other elements won't appear floating next to it. try adding clear: both to the css of the input box like this:

<input placeholder="Enter Name/Value" name="Name" id="NameID" size="40" 
style="clear:both; display:block;"/>

Upvotes: 2

Mauricio Souza Lima
Mauricio Souza Lima

Reputation: 608

The problem with your style is the float: left, you have to clear the "floatness". At the p tag, include the clear:both, it tells the browser that nothing can float at its left or right.

<div class="abcd"  style="margin-left:10px;">
    <form id='some'>
        <fieldset style="display:block;float:left;">
            <input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC

            <input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC

            <input class="yy" id="sss" type="radio" name="group0" value="aaa"/> ABC

        </fieldset>
        <p style="clear:both">
            <input placeholder="Enter Name/Value" name="xxx" id="xxx" size="40" style="display:block;float:left;">
            <button type="button" id="xxx" style="width:100;">Process</button>
        </p>
    </form>
</div>

Upvotes: 21

user1601479
user1601479

Reputation: 59

paste

<div style="clear:both"></div>

after the fieldset.

Upvotes: 2

Phillip Schmidt
Phillip Schmidt

Reputation: 8818

Try adding the css rule to the radio buttons themselves. Like this:

<style type="text/css">
.group0
{
    display:block;
}
</style>

This assumes group0 is the group with all the radio buttons.

Upvotes: 0

Related Questions