coderslay
coderslay

Reputation: 14370

How to remove the top and bottom padding which gets automatically created in div tags

I have a Div like this

<div align="center">
    <p style="color: black; font-size: 10px;"><b>Summary</b></p>
</div>

And when i use this div the it shows me summary but with added padding on both top and bottom when i use it in jquery mobile.. How to remove this padding?

Upvotes: 2

Views: 10336

Answers (2)

Abandoned Cart
Abandoned Cart

Reputation: 4676

If you are using the content UI element and any div that is dynamically sized, the automatic margins are generated by the content tag in jQuery mobile. Add this to your CSS:

.ui-content {
    margin: 0; padding: 0;
}

Upvotes: 2

QQping
QQping

Reputation: 1370

You have multiple ways to disable the padding in a div. first one is to define the element style

<div style="padding: 0;">...</div>

second one (and much prettier) is to define an ID in your div like

<div id="myID">...</div>

and set in your css the padding values to zero like this:

#myID{ padding:0; }

If it isn't padding, you can try margin: 0; too.

Most of html elements have by default margin and padding. to disable this put the following part on top of your .css file:

*{
    margin: 0;
    padding: 0;
}

Upvotes: 8

Related Questions