Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS style=display:block not working

Tags:

html

css

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.

like image 620
rajeev Avatar asked Aug 15 '12 21:08

rajeev


People also ask

What does display block do in CSS?

display: block An element that has the display property set to block starts on a new line and takes up the available screen width. You can specify the width and height properties for such elements. Examples of elements that are at block-level by default are <div> , <section> , <p> , and lots more.

Is Div display block by default?

The default display value for most elements is block or inline . This panel contains a <div> element, which is hidden by default ( display: none ). It is styled with CSS, and we use JavaScript to show it (change it to ( display: block ).

What is display inline block in CSS?

The display: inline-block Value Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.

How do I change display none to block?

getElementById("element"). style. display = "none"; To show an element, set the style display property to “block”.


1 Answers

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>
like image 90
Mauricio Souza Lima Avatar answered Oct 04 '22 04:10

Mauricio Souza Lima