关于网友提出的“css里面设定的长宽为什么和实际不符呢?”问题疑问,本网通过在网上对“css里面设定的长宽为什么和实际不符呢?”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:css里面设定的长宽为什么和实际不符呢?
描述:
css
如图

直接设定元素宽高就是正常的,拿到css里面宽高就变小了。网上说是没有初始化,引入了初始化的css还是不对。
不知道为毛
图形特效处理
坐标变换
init.css
/* css reset www.admin10000.com */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
margin:0 auto; padding:0px; border:0px ;
/*margin:0; padding:0;*/ }
body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
td,th,caption { font-size:14px; }
h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }
address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}
a { color:#555; text-decoration:none; }
a:hover { text-decoration:underline; }
img { border:none; }
ol,ul,li { list-style:none; }
input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; }
table { border-collapse:collapse; }
html {overflow-y: scroll;}
/* css common */
.clearfix:after {content: "."; display: block; height:0; clear:both; visibility: hidden;}
.clearfix { *zoom:1; }
解决方案1:
canvas 元素的 width 和 height 设置的是画布内的像素多少,也就相当于图片的实际尺寸。
css的 width 和 height 设置的是画布在页面上显示的大小。
解决方案2:
你可以debug一下,看看具体是哪里不对
解决方案3:
width: 420 ;
最好带上px,单位
以上介绍了“css里面设定的长宽为什么和实际不符呢?”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/949860.html