最近画图,需要根据用户的输入来动态更改画布大小。
但是用js改变完画布大小后发现图形都被拉伸了。想了半天没弄懂,然后搜索了下解决办法。原来是不允许随便用js来控制canvas的长宽。
canvas的默认长宽是 300 * 150.
不拉伸的解决办法:var theCanvas = document.getElementById("canvasId");
theCanvas.width = 50...
分类:
Web程序 时间:
2015-04-19 06:30:36
阅读次数:
114
一、定义图片边框方法1:border-style:dotted(点划线)|dashed(虚线)|solid;border-color:参数;border-width:数值;方法2:border:style(必须放在第一个位置) color width;方法3:border-left-style:so...
分类:
Web程序 时间:
2015-04-18 19:07:27
阅读次数:
126
目录:1、Div+Css布局教程(-)CSS必备知识注:本教程要求对html和css有基础了解。一、CSS布局属性Width:设置对象的宽度(width:45px)。Height:设置对象的高度(Height:45px;)。Background:设置对象的背景颜色、背景图像。1.背景颜色backgr...
{ float:left; width:190px; padding-top: 0; white-space: nowrap; overflow: hidden; -o-t...
分类:
其他好文 时间:
2015-04-18 16:05:34
阅读次数:
123
(三)列表与方块方块: width: height: top: left:列表: list-style-type: list-style-position: list-style-image:dispaly: none-不显示;block-块显示(独占一行) ;inline-不独占一行(width,...
分类:
Web程序 时间:
2015-04-18 12:44:09
阅读次数:
164
题目:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining...
分类:
移动开发 时间:
2015-04-17 23:51:07
阅读次数:
163
使用style替换背景,防止Activity黑色背景闪过1.原来的布局<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_...
分类:
移动开发 时间:
2015-04-17 22:25:19
阅读次数:
210
1.max-width在这种情况下使用max-width替代width可以使浏览器更好地处理小窗口的情况。这点在移动设备上显得尤为重要,调整下浏览器窗口大小检查下吧!顺便提下,所有的主流浏览器包括IE7+在内都支持max-width,所以放心大胆的用吧。(参考:http://zh.learnlayo...
分类:
Web程序 时间:
2015-04-17 22:06:26
阅读次数:
153
css样式:
max-width: 230px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display:block;
float:left;...
分类:
其他好文 时间:
2015-04-17 20:35:38
阅读次数:
146
把svg标签下的所有元素所占的1000*1000大小在300*300中显示,代码如下:
var?svg?=?d3.select("body").append("svg")
????.attr("width",?300)
????.attr("height",?300)
????.attr("viewBo...
分类:
其他好文 时间:
2015-04-17 18:41:48
阅读次数:
190