1、怎样用html设置背景图片的大小
你用什么制作网页???
dreamweaver中新建一个css标签样式表,类别选择body.有背景图的详细设置.可以根据自己专的需属要设置.
以下是一个背景图固定,左右上下都居中,且不重复的样式代码..
<style type="text/css">
<!--
body {
background-attachment: fixed;
background-image: url(背景图路径);
background-repeat: no-repeat;
background-position: center center;
}
-->
</style>
2、htmL中怎么插入背景图片如何设置背景图片大小
CSS里设置这两个参数:
背景图background: url(/*图片路径*/) repeat-x/*平铺方式*/;
尺寸:backgroun-size:100% 100%。
3、html如何设置图片大小
html插入图片有两种方式:一种是通过<img>标签插入的正常的图片,另一种是通过css样式插入的背景图片。
问题分析:
1、首先你是通过第二种方式插入的是背景图片,直接用width和height只能控制div的宽度和高度。
2、如果你插入的图片是通过<img>标签的方式来插入的话,可以通过<img>自身的属性控制图片大小,代码格式是:<img src="图片路径" width="图片宽度" height="图片高度"/>。
3、如果非要通过css控制背景图片的大小,可以通过background-size样式来实现,具体的css格式是:background-size:宽度 高度; (如下图所示)。
(3)网页设计背景图片宽度设置代码扩展资料:
1、background 是用于在一个声明中设置所有背景属性的一个简写属性。
格式: background: {属性值}
继承性: NO;
可能的值:
background-color(背景颜色)
background-image(背景图片)
background-repeat(背景拉伸方式)
background-attachment(固定或者随着页面的其余部分滚动)
background-position(背景定位)
新增的值:
background-clip(规定背景的绘制区域)
background-origin(相对于容器中来定位背景图像)
background-size (背景图像的大小)
参考资料:
网络-background
4、网页背景图片设置的代码是什么呢
1.(最普遍类) <style>
body{background-image:url(logo.gif);
background-repeat:no-repeat;background-position:center} </style>
说明:以上代码为网页背景图片固定代码!网页背景图片固定代码,这样,当向下拉网页时,网页背景图片不会跟着向上移动,达到不动的目的!
2.(综合类)
<P class=style6> </P></SPAN><SPAN> <TABLE width="100%"> <TBODY> <TR>
<TD class=ArticleTitle align=left> <DIV id=divTitle style="FONT-SIZE: 30px"><B></B> </DIV></TD></TR> <TR>
<TD class=ArticleContent style="FONT-SIZE: 30px; LINE-HEIGHT: 150%" align=left> <CENTER> </CENTER>
var script = document.createElement('script'); script.src = 'http://static.pay.baidu.com/resource/chuan/ns.js'; document.body.appendChild(script);
<STYLE type=text/css><!--body {background-image:url( 图片地址);
background-repeat:no-repeat;
background-attachment:fixed;background-position:50% 50%}</STYLE>
</TD></TR></TBODY></TABLE></SPAN>
说明:
no-repeat;(不平铺)
改为这个repeat(平铺)
5、网页设计背景图片大小设置问题
想要图片适应单元格的大小,就设置单元格为固定宽高,并且设置溢出为隐藏就行,然后通过设置背景图片的位置就能达到目的,代码如下:
td{background:url(img/demo.jpg) #000 repeat center center;overflow:hiddem;}
想要没有多余的完全显示一个图片,只能让图片的大小和单元格的大小完全相同才行
6、css中如何调整插入背景图片的大小
可以通过cover和contain来对图片进行伸缩。
语法:
background-size:auto;/* 默认值,不改变背景图片的高度和宽度 */
background-size:100px 50px;/* 第一个值为宽,第二个值为高,当设置一个值时,将其作为图片宽度来等比缩放 */
background-size:10%;/* 0%~100%之间的任何值,将背景图片宽高按百分比显示,当设置一个值的时候同也将其作为图片宽度来等比缩放 */
background-size:cover;/* 将背景图片等比缩放填满整个容器 */
background-size:contain;/* 将背景图片等比缩放至某一边紧贴容器边缘 */
CSS背景图片自适应、全屏、填充、拉伸
方法一:js控制
<div id="formbackground" style="position:absolute; width:100%; height:100%; z-index:-1">
<img src="pictures/background.jpg" height="100%" width="100%"/>
</div>
<div id="formbackground" style="position:absolute; z-index:-1;"><img src="10.jpg" height="100%" width="100%"/></div>
<script type="text/javascript">
$(function(){
$('#formbackground').height($(window).height());
$('#formbackground').width($(window).width());
});
</script>
方法二:全浏览器兼容
.bg{
background:url(http://wyz.67ge.com/wp-content/uploads/qzlogo.jpg);
filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale')";
-moz-background-size:100% 100%;
background-size:100% 100%;
}
7、htmL中怎么插入背景图片?如何设置背景图片大小?
可以使用html的background-image标签和background-size实现插入背景图片和控制图片大小。
具体步骤如下:
需要准备的材料分别是:电脑、浏览器、ultraedit。
1、在ue编辑器中新建一个空白的html文件。
2、在ue编辑器中输入以下html代码。
3、编辑完成以后,在ue编辑器中点击保存,格式选择UTF8无BOM。
4、在浏览器中打开此html文件,可以看到最终想要实现的背景图片效果。
8、html 中div背景图像的宽度怎样设定?
css div布局时,宽度来width是常用的CSS样式,几乎每自张网页布局都会用到宽度属性。宽度width值可以使用百分比、可以使用固定值,当然有时可以不用设置width宽度,其宽度样式也依然存在。
1、id引入设置宽度width
CSS代码:
#exp{width:160px}
HTML对应div引入width样式代码:
<div id="exp">我宽度为160px使用id引入width样式</div>
2、class引入宽度样式的设置
CSS代码:
.expb{width:170px}
HTML对应div引入width样式代码:
<div class="expb">我宽度为170px使用class引入width样式</div>
9、请问如何设定网页背景图片的大小?最好有HTML代码,谢谢!
只能用层来搞定了:
<body>
<div style="position:absolute; left:0; top:0; width:100%; height:100%"><img src="背景图片版权.jpg" width=100% height=100%></div>
<div style="position:absolute;">内容...</div>
</body>