msg
msg

Reputation: 1540

not able to set background to full section

I have created a section using HTML5 + jquery. i set a image as background to that section, but image is not setting to full section.It leaves some 2px space at all 4 sides inside the section. My code is;

<div id="container" data-role="page">
    <div style="..." data-role="header"><h>HOME</h></div>
    <section id="mainsection">
    </section>
</div>

CSS:

#mainsection
{
    height:40px;
    width:40%;
    margin-left:5%;
    margin-top:5%;
    float:left;
    background: url("images/pic99.png") no-repeat;
    background-size : cover;
    background-color:red;
}

I have used background-size property in % too,which is also not working. And i'm using jquery-1.10.2.js, jquery.mobile-1.3.2.js, jquery.mobile-1.3.2.min.css. Background-color property is setting exactly to 100% & only i have this problem when using image in background property.

Upvotes: 0

Views: 97

Answers (3)

Prabhakaran Parthipan
Prabhakaran Parthipan

Reputation: 4273

Demo

Set margin and padding are 0px. Please try this...

#mainsection{
    margin:0px;
    padding:0px;
}

Upvotes: 1

Harinder Singh
Harinder Singh

Reputation: 338

try this

*{
padding:0px;
margin :0px; 
}

Upvotes: 0

Leo T Abraham
Leo T Abraham

Reputation: 2437

#mainsection
{
    margin:0px !important;
    padding:0px !important;
}

Upvotes: 0

Related Questions