我有一个div width:100px和height:100px(比方说)在里面,只有一个图像,高度总是固定的100px.
我想让图像水平居中.
这里有3个案例:
margin: auto在这里使用我希望图像的中心部分在div中可见.
意味着,如果图像的宽度是120px和div的宽度是100px,overflow:hidden
我希望图像的第10个px到第110个px是可见的(所以,图像的left: 10px和right: 10px隐藏在div下面)
这可能通过一些CSS属性吗?
(我不知道正在加载的图像的宽度!所以我希望它是动态的.还想避免javascript端计算找到额外的宽度和给予margin-left:-ve值bla bla ..)
另外,我不能给background-imagediv 的图像!
我给了'rotation:-90'来使x轴的标签旋转。但是该旋转甚至也适用于轴的标题。我该如何阻止呢?请任何人帮助我。下面是我正在使用的代码。
makeCharts = function() {
var chart1 = new dojox.charting.Chart2D("simplechart", {
title: "Production(Quantity)",
titlePos: "top",
titleGap: 5,
titleFont: "normal normal normal 15pt Arial",
titleFontColor: "orange"
});
chart1.addPlot("default",{type:"ClusteredColumns",
gap: 5,
animate:{duration: 500} })
chart1.addSeries("2008", [113.1,72.1,62.6,59.8,59.3,53.7,52.4,49.1,43.7,40.9], {fill: "#DDFEDC"});
chart1.addSeries("2007",[113.6,65.0,59.2,56.4,62.8,53.5,47.6,44.9,41.5,39.1], {fill: "#FCDEFD"});
chart1.addAxis("x", {
title:'x-axis title comes here',
includeZero: false,
labels:[
{value:1, text:'one'},
{value:2, text:'two'},
{value:3, text:'three'},
{value:4, text:'four'},
{value:5, text:'five'},
{value:6, text:'six'},
{value:7, text:'seven'},
{value:8, text:'eight'},
{value:9, text:'nine'},
{value:10, text:'ten'}
],
rotation:-90
}
);
chart1.addAxis("y", {
vertical: true,
includeZero: true,
from:0,
to:200, …Run Code Online (Sandbox Code Playgroud)