How to remove default padding and margin to elements inside a div

Hi there

this is my jsfiddle

As you can see I have placed a label and then there is a file upload option but problem is I am getting some space from top to a block I want all Elements Inside a block should start from top their should be no space in content inside it.

How can I do this?

If I understand what you’re asking, I would get rid of all the floats and use table-cell instead.

I’ve removed all the inline css and put it into the style sheet

.topImageBlock {
    background-color: red;
    width:100%;
    min-height:80px;
    padding: 0;
    margin: 0;
}

.vcontainer {
    display: table-cell;
    min-height: 10em;
    border:1px solid #000;
    padding: 1em;
}

input[type=submit] { width:70px; height: 40px; }

.vcontainer img {
vertical-align: middle;
}
label{
display:block;
}
<div class="topImageBlock">
    <p class="vcontainer">No Image to display</p>
    <div class="vcontainer">
    <form action="/uploadImage" method="post" enctype="multipart-formdata">
            New Upload:&nbsp;<input type="file">
            <input type="submit" value="ADD"/>
        </form>
        <span style="clear:both">
    </div>
</div>

If this isn’t what you want, you’ll need to make a screenshot so I can understand and try to help you.

Thanks DaveMaxwell

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.