How can I remove the padding if the header doesn't have a background image?


Bojandra Rania

There are a lot of headers, some with a background image of the bullet, for which, padding-left: 35px;for some reason, headers are now given, and some headers don't have a background image. Therefore, I want to remove the left-padding value by applying 0 pixels. what should I do?

jQuery(document).ready(function(){
    var ts = $('h1,h2,h3,h4,h5,h6');
    if(!ts.style.background) ts.css({'padding-left':'0px'});
});

The code above doesn't work. Please note: Background images are also used backgroundor givenbackground-image

Alan P.Johnny

Since it tsis a jQuery wrapper element, this styleattribute will not be present

jQuery(document).ready(function () {
    var ts = $('h1,h2,h3,h4,h5,h6');
    ts.filter(function () {
        return $(this).css('background-image') == 'none'
    }).css({
        'padding-left': '0px'
    });
});

Demo: violin

Related


How can I add a background image to the header?

Adam Binns Bensey Hi, does anyone know how to add a background image to the header area behind the nav and other images as my image seems to stop expanding when it reaches another image in the header tag? Thanks Adam :) http://jsfiddle.net/Binnsey/3xaq2mqn/ I'

How can I remove the padding around the background image?

Vincent How can I remove the "padding" around the background image? Here is a demo : https://jsbin.com/dobucizaqi/edit?html,css,output .foo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox=

How can I remove the padding around the background image?

Vincent How can I remove the "padding" around the background image? Here is a demo : https://jsbin.com/dobucizaqi/edit?html,css,output .foo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox=

How can I have a background image below the background color?

Lopadov I am wondering if there is a way to put the background image behind the background color. I have a color picker with a slider and when I iterate over the alpha channel I want a checkered image to show under the color, I think I can add the image to the

How can I add a background image to the header?

Adam Binns Bensey Hi, does anyone know how to add a background image to the header area behind the nav and other images as my image seems to stop expanding when it reaches another image in the header tag? Thanks Adam :) http://jsfiddle.net/Binnsey/3xaq2mqn/ I'

Body padding doesn't work with background image

username I'm filling my body labels like this because I'm using a navbar that's pinned to the top. I want the navbar to stay on top all the time. body { padding-top: 70px; } Now I want to add a background image to the body and want it to cover the whole sc

How can I remove the padding around the background image?

Vincent How can I remove the "padding" around the background image? Here is a demo : https://jsbin.com/dobucizaqi/edit?html,css,output .foo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox=

How can I have a background image below the background color?

Lopadov I am wondering if there is a way to put the background image behind the background color. I have a color picker with a slider and when I iterate over the alpha channel I want a checkered image to show under the color, I think I can add the image to the