国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

CSS+DIV:讓文本字符環繞在你的圖片周圍

2024-04-27 13:55:38
字體:
來源:轉載
供稿:網友

  看到上面的效果,你也許以為這是一張帶文字的圖片而已;呵呵,用你的鼠標去選取文字看看,發現了吧,這完完全全是一張圖片和文字的組合,下面我就來介紹它是怎么做的。

  先看看代碼:

   以下是引用片段:
<div id="info">
<h2>TRACKING YOUR IMAGES</h2>
<div id="holdit">
<img src="/imagelist/06/24/4fnpgj5042e6.jpg" alt="Winnie the pooh" title="Winnie the pooh" />
<em class="a420"></em>
<em class="a430"></em>
<em class="a400"></em>
<em class="a370"></em>
<em class="a340"></em>
<em class="a300"></em>
<em class="a270"></em>
<em class="a250"></em>
<em class="a240"></em>
<em class="a230"></em>
<em class="a230"></em>
<em class="a340"></em>
<em class="a340"></em>
<em class="a360"></em>
<em class="a540"></em>
<em class="a540"></em>
<em class="a540"></em>
<em class="a550"></em>
<em class="a550"></em>
<em class="a550"></em>
<em class="a550"></em>
<em class="a550"></em>
<em class="a550"></em>
<em class="a540"></em>
<em class="a460"></em>
<em class="a490"></em>
<em class="a500"></em>
<em class="a500"></em>
<p>"I shall have to wait until I catch up with it," said Winnie-the-Pooh. "Now, look there." He pointed to the ground in front of him. "What do you see there?"<br />
"Tracks," said Piglet. "Paw-marks." He gave a little squeak of excitement. "Oh, Pooh! Do you think it's a--a--a Woozle?"<br />
"It may be," said Pooh. "Sometimes it is, and sometimes it isn't. You never can tell with paw- marks."<br />
With these few Words he went on tracking, and Piglet, after watching him for a minute or two, ran after him. Winnie-the-Pooh had come to a sudden stop, and was bending over the tracks in a puzzled sort of way.<br />
"What's the matter?" asked Piglet.<br />
"It's a very funny thing," said Bear, "but there seem to be two animals now. This--whatever-it-was--has been joined by another--whatever-it-is--
and the two of them are now PRoceeding in company. Would you mind coming with me, Piglet, in case they turn out to be Hostile Animals?"<br />
Piglet scratched his ear in a nice sort of way, and said that he had nothing to do until Friday, and would be delighted to come, in case it really was a Woozle.<br />
"You mean, in case it really is two Woozles," said Winnie-the-Pooh, and Piglet said that anyhow he had nothing to do until Friday. So off they went together.</p>
</div>
</div>


   以下是引用片段:
#info h3{ text-align:center;
}
#holdit {width:700px; position:relative; margin:3em auto; padding:10px; border:1px solid #ddd;}
#holdit img {position:absolute; z-index:1; top:10px; left:10px; }
#holdit p { margin:0px; position:relative; z-index:10; line-height:18px; text-align:justify; font-size:10px; font-family:verdana, arial, sans-serif}
#holdit em {display:block; float:left; height:18px; clear:left; overflow:hidden; }
.a230 {width:230px;}
.a240 {width:240px;}
.a250 {width:250px;}
.a270 {width:270px;}
.a300 {width:300px;}
.a340 {width:340px;}
.a360 {width:360px;}
.a370 {width:370px;}
.a400 {width:400px;}
.a420 {width:420px;}
.a430 {width:430px;}
.a460 {width:460px;}
.a490 {width:490px;}
.a500 {width:500px;}
.a540 {width:540px;}
.a550 {width:550px;}


  接著我們來分析一下紅色加亮的部分:

  首先將包容對象#holdit設置成相對定位(確保等下的img絕對定位以它左上角為原點)

  接著把#holdit里面的img設成絕對定位且z-index高度為1,這樣img就脫離文檔流了

  將em標簽設置左浮動,高度和p的ling-height要一樣,再根據圖片的圖案分別設置每個em的寬度(記得要用clear來清除浮動)

  最后把P設置成相對定位且z-index高度設置大于img的數值

  其實我們也可以直接將圖片作為為#holdit的背景,這樣就不需要專門為img來設置CSS


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 肃宁县| 东乡族自治县| 鞍山市| 曲松县| 巴南区| 台东市| 新闻| 鹤岗市| 溆浦县| 金川县| 罗甸县| 炉霍县| 肇州县| 中卫市| 韶关市| 涟水县| 天气| 德阳市| 铜川市| 静宁县| 渝北区| 甘肃省| 宁阳县| 大连市| 阿荣旗| 斗六市| 永兴县| 广东省| 丹巴县| 新蔡县| 新巴尔虎左旗| 永丰县| 杨浦区| 米泉市| 漳浦县| 泾川县| 靖远县| 靖安县| 桂阳县| 通城县| 扶绥县|