Click here to Skip to main content
15,885,960 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Does anyone know on how to combine multiple stylesheets into one? For example I have

<link rel="stylesheet" type="text/css" href="abc.css" />
<link rel="stylesheet" type="text/css" href="efg.css" />
<link rel="stylesheet" type="text/css" href="hij.css" />
in mysite.html. How can I combine the above 3 stylesheets into one?

thank you.


What I have tried:

how to combine multiple stylesheets into one
Posted
Updated 20-Feb-17 5:33am
Comments
jaket-cp 20-Feb-17 12:27pm    
if copy and pasting does not work for you - you could try command line to merge the files using copy
copy /b *.css xyz.css
or
copy /b abc.css+efg.css+hij.css xyz.css
check out this link: http://stackoverflow.com/questions/2477271/concatenate-text-files-with-windows-command-line-dropping-leading-lines

if that does not work for you - check out this link
http://www.wikihow.com/Merge-Text-(.Txt)-Files-in-Command-Prompt

Use notepad to paste the contents of the three css files into a single css file.
 
Share this answer
 
Paste the contents of the 3 css files in the order that they appear into one text file and call it say 'three_in_one.css", then link it to your html file
<link rel="stylesheet" type="text/css" href="three_in_one.css">
 
Share this answer
 
v2
Comments
Karthik_Mahalingam 20-Feb-17 10:50am    
5ed!
Manoj Dhakar 20-Feb-17 11:02am    
please share demo
Karthik_Mahalingam 20-Feb-17 11:34am    
:( step by step procedure added in my solution..
if that too doesn't help, I am sorry dude.
based on the comment from Peter's solution
Quote:
please share demo


Step 1: Create/open a new Notepad file
Step 2: open the abc.css file in a notepad (right click -> open with notepad ), copy the content and paste it in the new notepad file ( step 1 )
Step 3: open the efg.css file in a notepad (right click -> open with notepad ), copy the content and paste it at the end in the new notepad file ( step 1 )
Step 4: open the hij.css file in a notepad (right click -> open with notepad ), copy the content and paste it at the end in the new notepad file ( step 1 )
Step 5: Now save the new file as AllFile.css and copy the file and place it in your project root folder
Step 6: Now delete the 3 files abc.css, def.css, ghi.css
Step 7: now add the below reference
HTML
<link rel="stylesheet" type="text/css" href="AllFile.css" />
 
Share this answer
 
Comments
Peter Leow 20-Feb-17 22:40pm    
Nice, 5!
Karthik_Mahalingam 20-Feb-17 22:56pm    
Thanks Peter :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900