Using CSS in netbeans there is some basic rules you have to follow like
1. Do not use inline styles if possible;
2. Check that your editor does not add inline styles automatically;
3. Use the existing css classes from netbeans.css;
4. Use multiple css classes on a single element for more complicated styles;