導航:首頁 > 萬維百科 > 網頁設計如何設置div背景

網頁設計如何設置div背景

發布時間:2020-11-05 07:01:30

1、網頁製作CSS+DIV如何控制文字背景效果問題?

給相冊分頁的相冊a標簽設置一個class類為current,
.current , a:hover { color:red;background:url(地址)};

2、網頁設計中怎麼讓一張圖片填充滿整個畫面 求代碼

1、如果樓主只是將其當做一張圖片顯示,可以通過css控制,如img{width:100%;height:100%;}.
否則需要將其作為網頁背景的話可以試試如下方法:
2、如果這張圖片為背景圖片由於背景圖片不具有伸縮性,只能通過別的方法繞著解決,在ie中可以用<body
style="filter:progid:dximagetransform.microsoft.alphaimageloader(src='1.jpg',sizingmethod='scale')">,實現背景拉伸鋪滿整個瀏覽器,但其它的瀏覽器不支持。
這時可以拐個彎,設置兩層div,底層div當做背景使用,放置一張圖片即可。
<div id="background" style="position:absolute;z-index:-1;width:100%;height:100%;top:0px;left:0px;"><img src="1.jpg" width="100%" height="100%"/></div>
再將網頁內容放置到第二層上<div id="content">頁面內容</content>
3、網頁背景圖片默認情況下是重復平鋪滿整個頁面。上面2方法是要求圖片不重復,但又得占滿瀏覽器所採用的方法。

3、css手機版頁面製作時如何讓背景圖片適應div的高度和寬度

具體步驟如下:

1、輸入position:fixed; top: 0; left: 0;使整個div固定在屏幕的最上方和最左方。

2、輸入width:100%;height:100%; min-width: 1000px;這個可以適合div的高度和寬度,而min-width是為了實現讓屏幕寬度在1000px以內時,div的大小保持不變。

3、輸入background-size: cover;-webkit-background-size: cover;-o-background-size: cover;使圖片隨屏幕大小同步縮放,但是有部分可能會被裁切,不過不至於會露白,下面兩句是為chrome和opera瀏覽器作兼容。

4、輸入background-position: center 0;使圖片的位置,居中,靠左對齊。

4、html網頁設計裡面怎麼平鋪背景圖片

html網頁設計裡面平鋪背景圖片的代碼如下:
<html>
<body>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:100%; height:100%">
<img src="pictures/background.jpg" width="100%" height="100%"/>
</div>
</body>
</html>
網頁背景默認是平鋪整個屏幕的,可能有以下原因導致不能平鋪:

1、圖片不夠大,又background屬性不能拉伸圖片;
2、只能用個div,把其z-index值設為負,並使這個div大小為整個body大小,在div里用<img> ;
3、body的background屬性去掉,要不然會被遮住。

5、網頁設計div中背景圖片怎麼沾滿整個該div

你的意思是背景圖的樣式設置中,不要橫向或者縱向重復,是不是?那麼你在設置該樣式表的時候,就把圖片的尺寸(長和寬)和div的尺寸(長和寬)設置一樣大小,就可以了,而且背景圖不讓它重復!

6、網頁設計中,怎麼用CSS做出磨砂的背景效果?

代碼:透明背景(帶磨砂玻璃效果)註:在粘貼到空白模板前一定先打個空格。

<STYLE type=text/css>

.bodytop{background:#transparent}

.banner{ background:#transparent}

.menu{ background:#transparent}

.bodyBg {background:#transparent;filter:progid:DXImageTransform.Microsoft.gradient(GradientType ='1',enabled='true',startColorstr=#AAFFFFFF, endColorstr=#AAFFFFFF);}

.zone{ background:#transparent}

.bodyBottom{background:#transparent}

.feeds .up{background:#transparent}

.feeds .down{background:#transparent }

.feeds .function{background:#transparent}

.feeds .page{background:#transparent}

.aList .sysHand .up{background:#transparent}

.aList .sysHand .down{background:#transparent}

.gbook .sysHand .up{background:#transparent}

.gbook .sysHand .down{background:#transparent}

.gbook .title{display:none;}

.logo{display:none;}

.gbook .page{background:#transparent }

.gbook .login{background:#transparent}

.box_1{background:#transparent}

.box_2{background:#transparent}

.calendar{background:#transparent}

.calendar .mid{background:#transparent}

.calendar .top{background:#transparent}

.calendar .title{background:#transparent}

.calendar .bold td{background:#transparent}

.calendar .bottom{background:#transparent}

.callboard .mid{background:#transparent}

.callboard .mid img{background:#transparent}

.callboard .front{background:#transparent}

.callboard .back{background:#transparent}

.callboard table{background:#transparent}

.callboard .up{background:#transparent}

.callboard .down{background:#transparent }

.sysBr{background:#transparent}

.sysBr210{background:#transparent}

.label{background:#transparent}

.label .mid{background:#transparent}

.label .top{background:#transparent}

.label .bottom{background:#transparent}

.photo{background:#transparent}

.photo .mid{background:#transparent}

.photo .image{background:#transparent}

.photo .top{background:#transparent}

.photo .bottom{background:#transparent}

.links{background:#transparent}

.links .up{background:#transparent}

.links .down{background:#transparent }

.links .mid{background:#transparent}

body{background:url("
http://s11.sinaimg.cn/orignal/439175a380fda7635072a
") repeat fixed!important;}

.add{background:#transparent}

.add .ico{background:#transparent}

</STYLE>

7、htmL中怎麼插入背景圖片如何設置背景圖片大小

CSS里設置這兩個參數:

背景圖background: url(/*圖片路徑*/) repeat-x/*平鋪方式*/;

尺寸:backgroun-size:100% 100%。

8、網頁設計,div層如何添加背景圖?

是的,如果直接給div寫樣式,確實是所有的div都會應用此樣式;
方法有很多,你可以定義一個樣式名,例如 .cc:{background:#999},所需要添加此樣式的那個div 設置class="cc";
方法二 :你也可以定義一個id然,例如 #dd:{background:#999},給你所需要添加此樣式的那個div設置 id="dd";
明白了嗎?
希望我的回答對你有幫助,望採納。。。謝謝了~~~

與網頁設計如何設置div背景相關的知識