I am designing my theme for my website, and have no other CSS files in my folder besides template.css.
.header-wrap,
.nav-wrap,
.slideshow-wrap,
.body-wrap,
.sub-footer-wrap,
.footer-wrap {float: left; width: 100%; clear: both;}
.header,
.nav,
.slideshow,
.body,
.sub-footer,
.footer { width: 960px; margin: 0 auto;}
.header-wrap { height: 118px; background: url('files/img/background/bg-header.png')
repeat-x; border-bottom: 1px solid #6A6A6C}
.nav-wrap { height: 38px; background: url('files/img/background/bg-nav.png') repeat-x;
border-top: 1px solid #D9D9DB; border-bottom: 1px solid #B8B8BA}
.body-wrap { background: #F4EDDB url('files/img/background/bg-body.png') repeat-x;}
I don't believe that the issue is relating to that but there must be something else doing this to my webpage:
The red lines show the whitespace that is being generated for some unknown reason. I have been looking at this for a while and have not been able to find the source. I was wondering if anyone has had an issue like this before? Or someone that might be able to point me in the right direction to fix the matter. I have also tried multiple browsers and have the same issue. I have also made sure that it wasnt just an administration issue. It keeps happening no matter what. I am using Google Chrome currently.
--EDIT--
Here is my jsfiddle for those of you who asked (it still does it on there too) this has the full html
http://jsfiddle.net/RCMh7/
Add this to your css.
body { margin: 0px; padding:0px}
Or google "reset.css" and add it into your theme, the Eric Meyer one is fairly popular.
http://www.cssreset.com/
you should put margin-top:0 and margin-left:0 on this divs.
can you show on jsfiddle for us? or a link page?
Use the firebug for firefox tool to check that CSS issue . It might be occurring just due to some background image or CSS file. For all CSS linked to that theme check that theme's .info file also.
Although As per my experience you will able to get exact source of CSS by using firebug .
It may be some background kind of image or CSS effect.
I've a Joomla3 website with a custom template looking fine in most browsers but awful in IE8. Lots of the elements just don't seem to be picking up background colours and are just white.
For instance the footer normally has a background colour. When I look at the template.css file (compiled from bootstrap and my custom template.less file) you can see the footer formatting
.footer .container {
padding: 5px;
border: 3px solid #bbbbbb;
padding-top: 0px;
border-top: 0px;
-webkit-border-radius: 0px 0px 4px 4px;
-moz-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px;
background-color: rgba(245,248,250,0.7);
}
But when I use the website development tools of ie8 (via wine on my mac - in case that makes a difference) to examine why it is just white in ie8, I see
which seems to show that the background-color of .footer .container is just being ignored.
Why would this be? Is this because it's compiled into a rgba format by the less compiler?
Many thanks for any help on this and how I might solve it.
CSS3 colors, such as rgba() are not supported by IE8, that's why it's not working.
You will have to take an alternative approach for specifying the background-color if you want support in IE8. If you don't mind losing the transparency, just use background-color:rgb(245,248,250); or.. background-color: #F5F8FA;
See http://caniuse.com/css3-colors
What you can do is import css3.js in your website. This javascript files allows you to use CSS3 attributes that will work on older browser that wouldn't usually support it.
http://imsky.github.io/cssFx/
Once you've imported that, you can use the following as you were before:
background-color: rgba(245,248,250,0.7);
Just to be on the safe side, I think it's always good practice to have a fallback, just incase, like so:
background-color: #F5F8FA;
background-color: rgba(245,248,250,0.7);
Note that the fallback comes before rgba()
Hope this helps
I encountered this same issue when using IE11 in enterprise mode.
I had this style set:
.heading {
background-color:#f1f1ef;
border-style:solid;
border-color:#E4E3DD;
border-width:1px;
}
and my table heading did not have the background color:
<th class="heading">Test</th>
I had to manually set a property bgcolor for this to work in Enterprise mode:
<th class="heading" bgcolor="#f1f1ef">Test</th>
For some reason a website that recently went live has now completely screwed in IE9. Not sure what has happened to screw it all up but I'm left desperately needing to apply the fixes as the site is actually live.
There are some major ones and some minor ones.
The site is http://bit.ly/8oRMih
The site views fine in Firefox and Chrome.
When viewed in IE9, the left hand sidebar (left_column) doesn't appear horizontally level with the jQuery slider (jtabslider).
The CSS for the id left_column is...
clear: left;
width: 200px;
margin-top: -34px;
margin-right: 10px;
overflow: hidden;
border-left: 4px solid #990000;
border-right: 4px solid #990000;
border-bottom: 4px solid #990000;
None of our designers are free currently and I'm simply hopeless at debugging for IE so would be really grateful if any CSS wizards could lend a hand in resolving the issues if possible please.
Let me know if there is more info needed from me.
Thanks in advance.
Validate your HTML.
The problem is the first issue listed:
No DOCTYPE found! Checking with default XHTML 1.0 Transitional Document Type.
No doctype means that IE is using quirks mode which emulates IE5.5. Which sucks. So your site looks broken.
I'm, styling a hyperlink which has an own class.
.myLink
{
display:block;
padding: 4px 9px;
margin: 0px 6px;
}
.myLink:hover
{
background-color: #E4E4E4;
padding: 4px 9px;
margin: 0px 6px;
color:#000;
}
For the removing, I have this:
.myLink, .myLink:active, .myLink:visited
{
color:#000;
text-decoration:none;
}
In IE everything is working fine, but in Firefox my link gets underlined WHILE clicking on it.
I thought, if I definde the ":active" part, it's going to work, but it isn't.
Help please.
This sounds less like a CSS issue but more like browser preferences/overrides. I'd try to add !important to the text-decoration attribute, but actually looking for the reason would be the even better solution. Best solution would be checking the origin of the style using a tool (IE's developer tools or Firefox' Firebug).
If your are using a CMS or something with pre defined CSS files, it might be a browser specific CSS file causing this, as they will override the main CSS file. Even if you are not using a CMS or something with browser specific CSS files try Firebug in Firefox, this will tell you where in the CSS file the style is coming from and what CSS file is generating it.
www.getfirebug.com
Either use !important or make sure your ".myLink, .myLink:active, .myLink:visited" rules are below in order
Say you had a dynamically generated site that has been worked on by too many people, past and present, and you now have a collection of shared stylesheets that contain over 20,000 lines of CSS. It isn't organized at all, there are some class and id-based selectors but also way too many tag-based selectors. And then say you have 100 templates that use these styles, via some controller.
Is there a tool, something that works like Firebug perhaps, that you can point at a url and it would determine all of the applicable CSS selectors for that page and dump them to a file? Basically some way to rip apart the shared stylesheets on a page by page basis.
Hands down the best tool that actually does exactly what you want by only getting the used CSS on the page and allows you to simply copy it to your clipboard is this Chrome extension CSS Used
Pretty Picture Example
I've used Dust-Me Selectors before, which is a Firefox plugin. It's very easy to use and versatile as it maintains a combined list across a number of pages of which CSS values are used.
The downside is that I wasn't able to automate it to spider an entire site, so I ended up using it just on key pages/templates of my site. It is very useful nonetheless.
http://www.sitepoint.com/dustmeselectors/
https://addons.mozilla.org/en-US/firefox/addon/dust-me-selectors/
Contrary to the comment above Dust-Me Selectors 2.2 is compatible with Firefox 3.6 (I've just installed it).
These look promising:
Unused-CSS.com -- Service that spiders your website and emails you the results
CSS Usage -- Firebug addon
(Not for firefox but maybe this helps someone)
If you are working on chrome you can use this extension:
CSS remove and combine (https://chrome.google.com/webstore/detail/css-remove-and-combine/cdfmaaeapjmacolkojefhfollmphonoh)
lets you download a combined css with all used styles
shows unused styles in popup window
includes generated styles
I came across Uncss-Online - Unofficial server, very convenient for testing or one-off usage! I think its the best tool I've come across.
UnCSS is a tool that removes unused CSS from your stylesheets. It works across multiple files and supports Javascript-injected CSS. It can be used in this way:
Copy & paste your HTML and CSS into provided boxes
Click button
Wait for magic to happen
Unused CSS is gone, take the rest and use it!
You can check their Github Page for other advanced ways to use this tool
Here's my solution using JavaScript :
var css = [];
for (var i=0; i<document.styleSheets.length; i++)
{
var sheet = document.styleSheets[i];
var rules = ('cssRules' in sheet)? sheet.cssRules : sheet.rules;
if (rules)
{
css.push('\n/* Stylesheet : '+(sheet.href||'[inline styles]')+' */');
for (var j=0; j<rules.length; j++)
{
var rule = rules[j];
if ('cssText' in rule)
css.push(rule.cssText);
else
css.push(rule.selectorText+' {\n'+rule.style.cssText+'\n}\n');
}
}
}
var cssInline = css.join('\n')+'\n';
In the end, cssInline is a textual list of all the steelsheets of the page and their content.
Example :
/* Stylesheet : http://example.com/cache/css/javascript.css */
.javascript .de1, .javascript .de2 { -webkit-user-select: text; padding: 0px 5px; vertical-align: top; color: rgb(0, 0, 0); border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); margin: 0px 0px 0px -7px; position: relative; background: rgb(255, 255, 255); }
.javascript { color: rgb(172, 172, 172); }
.javascript .imp { font-weight: bold; color: red; }
/* Stylesheet : http://example.com/i/main_master.css */
html { }
body { color: rgb(24, 24, 24); font-family: 'segoe ui', 'trebuchet MS', 'Lucida Sans Unicode', 'Lucida Sans', sans-serif; font-size: 1em; line-height: 1.5em; margin: 0px; padding: 0px; background: url(http://pastebin.com/i/bg.jpg); }
a { color: rgb(204, 0, 51); text-decoration: none; }
a:hover { color: rgb(153, 153, 153); text-decoration: none; }
.icon24 { height: 24px; vertical-align: middle; width: 24px; margin: 0px 4px 0px 10px; }
#header { border-radius: 0px 0px 6px 6px; color: rgb(255, 255, 255); background-color: rgb(2, 56, 89); }
#super_frame { min-width: 1100px; width: 1200px; margin: 0px auto; }
#monster_frame { -webkit-box-shadow: rgb(204, 204, 204) 0px 0px 10px 5px; box-shadow: rgb(204, 204, 204) 0px 0px 10px 5px; border-radius: 5px; border: 1px solid rgb(204, 204, 204); margin: 0px; background-color: rgb(255, 255, 255); }
#header a { color: rgb(255, 255, 255); }
#menu_2 { height: 290px; }
/* Stylesheet : [inline styles] */
.hidden { display: none; }
As of Sept 2020 this question is almost 10 years old. Most of the provided solutions no longer work or the linked projects have disappeared.
However, the question is still extremely relevant as Google now uses page speed as one of its prioritization metrics.
After doing a bunch of research into all the links listed, I found purgecss.com. This seems to be the best option to clean up unused CSS in modern web apps/SPAs using Angular, React, Vue, etc. There's also build integration with PostCSS, Webpack, Grunt, and Gulp.
Also, UnCSS still seems to be maintained. It's as powerful as PurgeCSS but not as integrated into build processes or single-page javascript apps.
SnappySnippet
There is an open source ad-on of chrome named SnappySnippet I found it lot better than other just extends the already available developer tools in chrome. You can even extract only one part of the page will all relevant css. Look at this stackoverflow post
uncss: Find Unused CSS - cli tool, uses phantomjs and executes JS on the page, can be used on URLs
grunt-uncss - only works on static files
(critical css - extracts CSS for elements visible in the browser window)
Check for PurifyCSS, and this for those who can handle CLI or Gulp/Grunt/Webpack
You can remove the unused style from single page or multiple page or from the entire project, even though the classes are being injected by javascript.
If you can google, there are tons of resources out there from which you can learn about PurifyCSS.
This Firefox extension will probably solve your problem, Dust-Me Selectors. There's also a tiny desktop app called CssCleaner or CssHelper but I was unable to find a link to it... (just have it here at my machine downloaded a long time ago for a similar task)
If you're dealing with single pages, you can also use my bookmarklet to quickly grab only the CSS that is actually used by the web page:
Go here (if this link is broken, you can also get it from pastebin).
Drag the big button under "Download Bookmarklet" onto your bookmarks toolbar.
That's it. Now whenever you want to encapsulate a static page (i.e., to make it portable or if you intend to serve it from its own iframe), just click on the bookmark and it will display all the used CSS on the current page in an overlay. Click on the shadow to close the overlay.
One good thing with this solution is that it supports responsive pages since the media queries are also extracted. As a bonus, media queries are sorted by viewport size specificity (e.g., #media (max-width: 767px) will come after #media (max-width: 1023px)).
If there's a need, I can also add an option to minify the generated CSS. Since I've only used this bookmarklet for my own needs, it hasn't been widely tested, so please report any issues in the comments.
NOTE: To make this bookmarklet work with local files in Chrome, add --allow-file-access-from-files to the Chrome shortcut target. Example:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files
Try using this tool,which is just a simple js script
https://github.com/shashwatsahai/CSSExtractor/
This tool helps in getting the CSS from a specific page listing all sources for active styles and save it to a JSON with source as key and rules as value.
It loads all the CSS from the href links and tells all the styles applied from them.
You can save the output in a JSON file with any name.
Hmm.. I'd throw some brute force at this by extracting the various CSS selectors using a serverside parsing of the CSS file, then run each of these as a jQuery selector within the browser. Not very elegant, but should work?
The #pamekar solution worked perfectly for me, extracting the used css classes from https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css.
Note that you have to copy the code from the bootstrap.min.css file and paste it into the css section of https://uncss-online.com.
You can also use http://getcssusedinapage.com to get the CSS used in a page. It's free, fast & gives you back much details along with minimified & optimized CSS code that you can just copy + paste in your website