我试图将谷歌提供的示例图表居中:https://google-developers.appspot.com/chart/interactive/docs/quick_start
我已经使用了基本的css居中我知道(margin-right: auto;margin-left: auto;),但似乎没有任何工作.到目前为止,我一直只处理文本和图像,所以任何帮助都会非常感激.
这是我正在使用的基本代码(包括谷歌图表javascript)
<!DOCTYPE html> <html> <head> <style>
div.chart_div {
margin-left: auto;
margin-right: auto;
width: 800px; }
</style>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// …Run Code Online (Sandbox Code Playgroud)