user2427839
user2427839

Reputation:

Removing extra class from CSS

The stylesheet have multiple references to specific ".wiki-content" class, i.e.

    .wiki-content ul,.wiki-content ol,.wiki-content dl {
    padding-top:0;
    margin-top:0;
        }

    .wiki-content a,.wiki-content a:link,.wiki-content a:visited {
    text-decoration:underline;
        }

    .wiki-content p,.wiki-content table,.view .wiki-content .cell:first-child,.content-preview .wiki-content .cell:first-child {
    padding:0;
        }

    .wiki-content table.confluenceTable {
    border-collapse:collapse;
        }

but HTML code have only one reference the this class, in body: <body class="mceContentBody wiki-content fullsize"> Further html have no any references to this class: the p, li, ul, a, tags have no .wiki-content class selector specified. I checked page using CSS Usage plugin, but it does not mark these .wiki-content CSS selectors as "Unseen", they all shown as green (legit) ones. Can I safely remove this .wiki-content class from CSS stylesheet? The page generated by Atlassian Confluence Wiki system, but I use a copy saved locally for offline use.

Upvotes: 0

Views: 452

Answers (4)

Matt Lambert
Matt Lambert

Reputation: 3665

Being that the class is on the body, it is probably being used to name-space the page. There may be other non wiki pages that use the same style sheet, but have different styles on the same tag or class. Name-spacing the entire page allows you to target only the styles that are appended with .wiki-content - Just a guess but I think that's what's happening.

End of the day, I would leave it as you may create some colliding styles if you remove it.

Upvotes: 0

Ceres
Ceres

Reputation: 3668

Check the parent element, if it has the class then it probably NOT safe to remove it.

<div class="wiki-content">
<ul></ul>
</div>

This would apply the style following style to the UL element

.wiki-content ul,.wiki-content ol,.wiki-content dl {
padding-top:0;
margin-top:0;
    }

The .wiki-content ul means to apply the style to any children UL elements of the element that has the class defined.

Upvotes: 1

seancdavis
seancdavis

Reputation: 2821

My approach is always to back up the stylesheet, then delete the lines from the current stylesheet and see if it negatively affects anything on the page.

That being said, if CSS Usage is showing the classes as seen, it's likely they are being used somewhere. But even if that's the case, it doesn't necessarily mean deleting the styles is really going to negatively affect your site.

Upvotes: 0

Steve Rydz
Steve Rydz

Reputation: 46

Yes. If there is no HTML in your site/app that has that class, you can safely remove it as the CSS is not being used anyway. I'd recommend using your text editors find functionality to double check that it isn't included anywhere though before you do remove it.

One thing to consider though, assuming you didn't write this CSS, maybe check with the developer who wrote it to see what the reasoning is behind it.

Upvotes: 0

Related Questions