2021年2月10日星期三

css text-align does not work unless in both local style and external stylesheet? Whats going on?

I have a css class .menu-bar.

<style>      .menu-bar { width: 100%; text-align: center; }  </style>  

If I place the class in external stylesheet, it won't load ( has no effect in html file ). If I place the class in local stylesheet (in head tag), it only works if the class is also defined in the external stylesheet. I know this, because I removed the class from external stylesheet and the local class did nothing. My observations have been, this is being caused by text-align. What is going on?

My implementing code:

<div class="menu-bar">      <div> Content </div>  </div>  

My intention is to place my css code in external stylesheets. In this scenario, I am having to duplicate this code which seems to demean the point of having external stylesheets. Any thoughts would helpful.

https://stackoverflow.com/questions/66148198/css-text-align-does-not-work-unless-in-both-local-style-and-external-stylesheet February 11, 2021 at 11:06AM

没有评论:

发表评论