Reputation: 115
This is the link for the code - link to jsfiddle
and here's the code -
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
.can_con {
border: 1px solid #b6ff00;
position: absolute;
top: 25px;
left: 600px;
}
li {
font-size: 60px;
}
</style>
</head>
<body>
<ul>
<li>Some Text 1</li>
<li>Some Text 2</li>
<li>Some Text 3</li>
</ul>
<div class="can_con">
<canvas id="#myCan" width="600" height="200" style="border:1px solid #f00;"></canvas>
</div>
</body>
</html>
Now what I would like to know is if there's a way to make the canvas element not disappear when the screen been zoomed in.
I mean that the current state is that the canvas element going to the right side of the screen and I would like to avoid this.
So thanks for any kind of help
Upvotes: 0
Views: 74
Reputation: 56
You can make your canvas
be moved bellow the <ul>
if you put both of them in a container which is floated left if there is not enough space for both of them.
<div class='col'>
<ul>
...
</ul>
</div>
<div class='col'>
<div class="can_con">
<canvas ...></canvas>
</div>
</div>
.col{
float:left;
}
.col:last-of-type:after{
content:"";
display:table;
clear:both;
}
Fiddle: http://jsfiddle.net/7pt6uw53/5/
Upvotes: 0
Reputation: 566
You can use float
and box-sizing
.can_con {
width:50%;
float:right;
box-sizing: border-box;
}
.can_con canvas{
width:100%;
display:block
}
ul {
width:50%;
float:left;
box-sizing: border-box;
}
li {
font-size: 60px;
}
and remove width
and height
from the <canvas>
tag
<canvas id="#myCan" style="border:1px solid #f00;"></canvas>
Updated fiddle: http://jsfiddle.net/7pt6uw53/4/
Upvotes: 1