I have multiple CSS files (the designer made several, bad iterations) that I need to combine to a single file. However, I don't want to just cat them together. I want to merge the properties for like selectors, ie:
file 1
#mainmenu {width:100%; background:#01568b; text-decoration: none; }
file 2
#mainmenu {width:100%; background:#01568b;}
Where the output would be
#mainmenu {width:100%; background:#01568b; text-decoration: none;}
obviously, this is a simple example, but should explain what I'm looking to do. Are there any tools available, or am I going to have to do this the hard way?
Use <style type="text/css"></style> in your header tag to merge the css and html into one file. Then paste your css in between the style tags.
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
Yes, It is possible to include one CSS file in another and it can be done multiple times. Also, import multiple CSS files in the main HTML file or in the main CSS file. It can be done by using @import keyword.
I think you can use the tool CSS Merge for this task.
However you might see some strage stuff going on, due to the importance of styles ect.
Test it in all browsers!
Here is a link http://www.tothepc.com/archives/combine-merge-multiple-css-files/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With