- This topic is empty.
-
AuthorPosts
-
July 8, 2016 at 2:18 am #243448
chitranjali
ParticipantHi guys,
I am using bootstrap css and I want the font colour of my navbar-header to be in white color, but when I put that in my css, it’s still is in blue color? when I saw in bootstrap CSS, the anchor tag seems to be having that blue color, how to override that? as class has more priority, it should be taking the color I specify right?
Attaching a codepen link here (http://codepen.io/chitranjali/pen/jAmrxg?editors=1100).
Thank you for you time and efforts.
July 8, 2016 at 4:17 am #243449Atelierbram
ParticipantThis should work:
.navbar-header a { color: white; }
July 11, 2016 at 6:24 am #243501chitranjali
ParticipantHi Atelierbram,
It’s working, thank you, but why didn’t that work when I just applied to .navbar-header class?can u please explain if possible?
July 11, 2016 at 1:03 pm #243516Atelierbram
ParticipantColor is one of those properties which are inherited. Here a color-value is earlier declared on the
a
(link) element in Bootstrap CSS. This value will be the same on alla
elements using Bootstrap unless it’s overridden (later in the cascade of CSS because the value for color is inherited): like I showed earlier, targeting thata
element in thatnavbar-header
specifically.July 11, 2016 at 1:03 pm #243517Atelierbram
ParticipantColor is one of those properties which are inherited. Here a color-value is earlier declared on the
a
(link) element in Bootstrap CSS. This value will be the same on alla
elements using Bootstrap unless it’s overridden (later in the cascade of CSS because the value for color is inherited): like I showed earlier, targeting thata
element in thatnavbar-header
specifically.July 12, 2016 at 5:28 am #243551chitranjali
ParticipantHi Atelierbram,
I understood your point, but what I was thinking is if the custom css is called after bootstrap css in my page, then I think we need not specifically target the a inside navbar-header right? a general a{ color:white;} would be working, But I didn’t understood when the bootstrap css is loading only ( we add that from settings tab in codepen), how ever, the earlier code is now working fine without any changes from my side :/
view-source:http://codepen.io/chitranjali/full/jAmrxg/
the above is source code of my page, can u tell me where the bootstrap stylesheet is loading and my custom css is loading?
Thank you for your help! sorry for too basic questions!
July 12, 2016 at 5:41 am #243552Atelierbram
Participantbut what I was thinking is if the custom css is called after bootstrap css in my page, then I think we need not specifically target the a inside navbar-header right? a general a{ color:white;} would be working
Yes, but now all of your links will be white, so if that’s what you want that is fine of course. If the background of your main-content would be dark then that may work out.
the above is source code of my page, can u tell me where the bootstrap stylesheet is loading and my custom css is loading?
I don’t understand what you mean with “where” in this context, but you use DevTools no? Just check the
head
in DevTools, you will see what is going on.July 12, 2016 at 6:03 am #243553chitranjali
ParticipantHi,
(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css ), this is the link I added in the settings page of that codepen, but when I look at that source code, I am not finding anything of this sort with <link rel=”stylesheet” > ,
but instead of that, there is
<link rel=”stylesheet” media=”screen” href=”https://assets.codepen.io/assets/fullpage/fullpage-82300606745a0f5722ec218ccdfae52a.css” />Did that combined both bootstrap and my custom css into one? :/
July 12, 2016 at 6:14 am #243554Atelierbram
ParticipantThe source code is only telling you so much, and Codepen is very dynamic as well … So for an accurate representation better use DevTools inspect element. There I see in the
head
:<link rel="stylesheet prefetch" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <style> .navbar-default { background-color: purple; } ul { color: GREY; } a{ color:white; } </style>
July 12, 2016 at 6:54 am #243555chitranjali
ParticipantHi Atelierbram,
Thanks for the suggestion, I will use that :), thank you for all the help .
Regards,
Chitra.July 12, 2016 at 7:48 am #243558Atelierbram
ParticipantGood luck, but now I think about it, in Codepen you can also use “Debug Mode” (Change View -> Debug Mode) and then do view source. Take care.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.