How to save files on Mac with extension I want?
It sounds like you are in rich text mode, so the editor is trying to save the file in non-plain text format. In general for css/html/code you want just plain text.

In the "Format" menu, choose "Make Plain Text" then when you do a "Save As..." you should be able to just type whatever extension you need.

EDIT -- As Tetsujin mentions, you do should uncheck the 'if no extension, set as .txt' in the save menu so it doesn't try to append .txt as an extension.