How do I center a Bar Format from Google Visualization?

做~自己de王妃 提交于 2019-12-25 01:24:40

问题


This is a continuation of this question where I asked how to center a number (i.e. text return) from the Google Visualization API. The new issue I am having is that I want to show progress bars for a specific piece of data, and I would like to center them. I am using the Bar Format. However, my CSS does not seem to work. I know that I should be able to apply CSS to a specific tag within a named element (or I believe I can).

Here is picture of the current site:

I believe if I can remove float: left; as inherited from the google process and add margin: 0 auto; this will all work. Here is a JSFiddle of my work so far.


回答1:


Yes, removing the float:left; works well.

With reference to your question How do I center numbers in a table from Google Visualization API?, the solution is simple as stated in one of its anwser.

You need to overwrite the css inherited by the API for the span tag inside the td.

span{
    float:none !important;
}

Here's the fiddle for it: http://jsfiddle.net/a8e3re72/5/



来源:https://stackoverflow.com/questions/26759597/how-do-i-center-a-bar-format-from-google-visualization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!