1
I have the following code:
CSS:
.apoio{
float:left;
}
.box{
width:300px;
height:100px;
background-color:#666;
border-radius: 10px;
margin: 0 auto;
}
HTML:
<canvas class="apoio" id="cvs" width="500" height="200"></canvas>
<div class="box"></div>
The idea was for both of them to be on each other’s side, but...
How do I make them parallel and not that way?
EDIT 1: Inside the canvas I have a javascript:
<script>
window.onload = function ()
{
var data = {}
data.shipped = [<?php echo $mes_quant[$b]; ?>];
data.sold = [<?php echo $hoje_quant[$b]; ?>];
var bar1 = new RGraph.Bar({
id: 'cvs',
data: data.shipped,
options: {
gutterTop: 40,
gutterLeft: 70,
colors: ['rgba(0,0,255,0.2)'],
labels: ['Acessos Hoje/Mês'],
labelsAbove: data.shipped,
strokestyle: 'rgba(0,0,0,0)',
scaleZerostart: true,
textAccessible: true,
shadow: true
}
}).draw();
var bar2 = new RGraph.Bar({
id: 'cvs',
data: data.sold,
options: {
ymax: bar1.scale2.max,
gutterTop: 40,
gutterLeft: bar1.Get('gutterLeft'),
colors: ['pink'],
noaxes: true,
labelsAbove: true,
hmargin: 20,
ylabels: false,
backgroundGrid: false,
strokestyle: 'rgba(0,0,0,0)',
textAccessible: true,
shadow: true
}
}).draw();
};
</script>
Edit 2
<canvas class="apoio" id="cvs" width="500" height="200" style="position: absolute; left: 0px; top: 0px; display: inline; float: none;"></canvas>
float:left
in the box box does not solve?– Jorge.M
a <div> took the place of <canvas> in this way
– Geraldão de Rívia
Tried to float:right in the gray box? With this CSS I couldn’t simulate exactly your error
– hugocsl
Yes, but I need them to be on each other, the graphic on the left and the box in the middle, however, when I center the box, it is in the middle and below the graphic as in the image I posted
– Geraldão de Rívia
Post a sample of the canvas content. It may be throwing the box down.
– Sam
@dvd, updated
– Geraldão de Rívia
But then you can’t play. You have to put the canvas HTML after rendered. Go to the "inspect elements" of the browser and copy tupo inside the <canvas tag>.
– Sam
Go to "inspect elements", locate the <canvas> tag and right-click and choose "Copy > Copy outerHTML", then paste the question.
– Sam
@dvd, updated
– Geraldão de Rívia