0

I'm new to Bootstrap - sorry if this question has been asked before; I searched it and could find only similar questions that didn't really help me - and I've read a lot that we should refrain from editing the original bootstrap.css as best we can.

Inevitably though, we'll try to do something that bootstrap doesn't directly support (or will need expanded) and we'll need to include our own code. For example, I'm working on a website and I changed some settings in the h1 style:

<h1 style="font-family:Lobster; font-size:72pt; color: #FF8300; margin-left:0px">Text here</h1>

so I used some in-line styles. Sometimes that's not always best, though. I wanted to change all links in my site to color: #FFF;. I had to change each one individually to:

<li><a style="color:#FFF" href="#">Hours</a></li>
<li><a style="color:#FFF" href="#">Menu</a></li>
<li><a style="color:#FFF" href="#">Story</a></li>
<li><a style="color:#FFF" href="#">Contact</a></li>

I realize I could have probably made a change to all links if I included and typed it up, but I'm not exactly sure what is considered the "right" or "best" way to do things and I don't want to go about starting bad habits.

Any help for this would be great. Thanks!

1 Answers1

5

Make a new style sheet called custom.css or whatever. Then link this style sheet AFTER your bootstrap.css link in your document head. Then write all your styles on your custom css file, not the bootstrap one.

<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
</head

CSS:

a {color:#fff;}
Rachel S
  • 3,780
  • 3
  • 24
  • 37
  • This is exactly what I was looking for, thank you. If I may add another question, do you always do all css changes in this custom file, or is it sometimes permittable to use inline css? How do you make the distinction of one or the other? – Marina Rose May 11 '16 at 15:13
  • Ideally all CSS should be in a separate file. But nobody's going to give you a ticket if you absolutely must use inline styling very sparingly. If this answered your question, you can mark it as an answer. – Rachel S May 11 '16 at 15:18
  • 2
    There is a good discussion here on SO about your last question: http://stackoverflow.com/questions/3142710/inline-styles-vs-classes – Pipo May 11 '16 at 15:19
  • Thank you!! I will definitely take a look at that discussion. – Marina Rose May 11 '16 at 15:27