- 浏览: 35872 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
shenbai:
thanks。我试了一下,实际上只需要调用waitForBac ...
HTMLUnit : javascript 对页面的更改如何获得
1. 为图片加边框
以下CSS中,第一种是以详细方式进行设置,第二种以缩略形式进行设置。
2. 背景图片位置设定
下面例子中,把背景图片放置到了右下角位置。
用background-position属性设置背景图片的位置,可选值有top (表示top center),right(表示right center),left(表示left center),bottom(bottom center),还有各种组合值top left, top center, top right, center left, center center, center right, bottom left, bottom center, bottom right等等;还可以用百分比,比如30%表示30% 50%的位置,也可以是具体的值如 20px 20px这样的值。
3. 页面滚动时,背景图固定
把background-attachment属性设置为 fixed。
4. 可以给任何元素设置背景
在任何标签上都可以使用背景颜色、图片, 如下例子给div, h1, a(链接)都加了背景图片。
5. 把文字放到图片上方
由于任何元素都可以设置背景图片、颜色,所以文字也可以放在图片上方。很久很久以前要通过图像处理软件做出来的效果,现在用CSS就能做到了。
6. 为页面设置多个背景图片
7. 如何在页面上使用透明色
把你的图片保存为24位PNG格式,就可以生成真正的透明图片。但是IE6不支持Alpha通道图像,所以不能渲染透明PNG图片。在第7章对如何在IE6中实现透明背景做进一步阐述。
(第三章 完)
以下CSS中,第一种是以详细方式进行设置,第二种以缩略形式进行设置。
<div id="pg60"> <img class="pg60" src="chpt3/myfish.jpg" alt="My Fish"/> <img class="pg60_imgborder" src="chpt3/myfish.jpg" alt="My Fish"/> </div>
img.pg60 { border-width : 1px; border-style : solid; border-color : #000000; } .pg60_imgborder { border : 1px solid #000000; }
图3-1
2. 背景图片位置设定
下面例子中,把背景图片放置到了右下角位置。
用background-position属性设置背景图片的位置,可选值有top (表示top center),right(表示right center),left(表示left center),bottom(bottom center),还有各种组合值top left, top center, top right, center left, center center, center right, bottom left, bottom center, bottom right等等;还可以用百分比,比如30%表示30% 50%的位置,也可以是具体的值如 20px 20px这样的值。
<div id="pg67content"> <h1>Chinese-style stuffed peppers</h1> <ul> <li>1 tablespoon of oil</li> <li>1 crushed garlic clove</li> <li>Peeled and finely chopped fresh ginger root</li> <li>250g minced pork, beef or Quorn</li> <li>1 chopped spring onion</li> <li>1 chopped celery stick</li> <li>Grated rind of 1 lemon</li> <li>Finely chopped red chilli (optional)</li> <li>4 large green peppers</li> </ul> <p>These stuffed peppers are lovely as a starter, or as a side dish for a Chinese meal. They also go down well as part of a buffet and even children seem to like them.</p> <p>Heat the oil in a wok. Add the garlic and stir fry until golden.</p> <p>Reduce the heat down and then add the ginger and the mince. Stir fry until this is nicely browned then add the other ingredients (apart from the peppers). Stir fry all of this together for a minute, then remove from the heat and allow to cool slightly.</p> <p>Core and remove the seeds of the peppers and cut them into quarters.</p> <p>Divide the mince mixture between these quarters and arrange the peppers in an oven proof dish</p> <p>Cook in a preheated oven at 200C for about 25 minutes then transfer to a serving dish and serve immediately.</p> </div>
#pg67content { background-color : #FFFFFF; padding : 1em 1em 40px 1em; background-image : url(chpt3/tick.gif); background-repeat : no-repeat; /* 设置背景图片的位置 */ background-position : bottom right; /* 可设位置参数如如下: top left, top center, top right, center left, center center, center right, bottom left, bottom center, bottom right */ /* 或用百分比 background-position : 30% 80%; */ /* 或用计量单位,如: background-position : 20px 20px; */ }
图3-2
3. 页面滚动时,背景图固定
把background-attachment属性设置为 fixed。
4. 可以给任何元素设置背景
在任何标签上都可以使用背景颜色、图片, 如下例子给div, h1, a(链接)都加了背景图片。
<div id="pg72_content"> <h1 class="pg72_header">Chinese-style stuffed peppers</h1> <div id="pg72_smallbox"> <ul> <li>1 tablespoon of oil</li> <li>1 crushed garlic clove</li> <li>Peeled and finely chopped fresh ginger root</li> <li>250g minced pork, beef or Quorn</li> <li>1 chopped spring onion</li> <li>1 chopped celery stick</li> <li>Grated rind of 1 lemon</li> <li>Finely chopped red chilli (optional)</li> <li>4 large green peppers</li> </ul> </div> <p>These stuffed peppers are lovely as a starter, or as a side dish for a Chinese meal. They also go down well as part of a buffet and even children seem to like them.</p> <p>Heat the oil in a wok. Add the garlic and stir fry until golden.</p> <p>Reduce the heat down and then add the ginger and the mince. Stir fry until this is nicely browned then add the other ingredients (apart from the peppers). Stir fry all of this together for a minute, then remove from the heat and allow to cool slightly.</p> <p>Core and remove the seeds of the peppers and cut them into quarters.</p> <p>Divide the mince mixture between these quarters and arrange the peppers in an oven proof dish</p> <p>Cook in a preheated oven at 200C for about 25 minutes then transfer to a serving dish and serve immediately.</p> <p><a href="menu.html" class="pg72">Back to the main menu</a></p> </div>
#pg72_content { margin: 2em 4em 2em 4em; background-color: #FFFFFF; padding: 1em 1em 40px 1em; background-image: url("chpt3/tick.gif"); background-repeat: no-repeat; background-position: bottom right; } #pg72_smallbox { background-image : url(chpt3/boxbg.gif); background-repeat : repeat-x; float : left; margin-right : 20px; width : 220px; border : 1px solid #d2d7e4; } h1.pg72_header { background-image : url(chpt3/dotty.gif); background-repeat : repeat-x; background-position : bottom left; padding : 0 0 6px 0; color : #41667f; font-size : 160%; font-weight : normal; background-color : transparent; } a.pg72:link, a.pg72:visited { color : #41667f; background-color : transparent; padding-right : 10px; } a.pg72:hover { background-image : url(chpt3/arrow.gif); text-decoration : none; background-position : center right; background-repeat : no-repeat; }
图3-3
5. 把文字放到图片上方
由于任何元素都可以设置背景图片、颜色,所以文字也可以放在图片上方。很久很久以前要通过图像处理软件做出来的效果,现在用CSS就能做到了。
<div id="pg75_content"> <h1 class="pg75_header">Chinese-style stuffed peppers</h1> <div id="pg75_smallbox"> <h2>Ingredients</h2> <ul> <li>1 tablespoon of oil</li> <li>1 crushed garlic clove</li> <li>Peeled and finely chopped fresh ginger root</li> <li>250g minced pork, beef or Quorn</li> <li>1 chopped spring onion</li> <li>1 chopped celery stick</li> <li>Grated rind of 1 lemon</li> <li>Finely chopped red chilli (optional)</li> <li>4 large green peppers</li> </ul> </div> <p>These stuffed peppers are lovely as a starter, or as a side dish for a Chinese meal. They also go down well as part of a buffet and even children seem to like them.</p> <p>Heat the oil in a wok. Add the garlic and stir fry until golden.</p> <p>Reduce the heat down and then add the ginger and the mince. Stir fry until this is nicely browned then add the other ingredients (apart from the peppers). Stir fry all of this together for a minute, then remove from the heat and allow to cool slightly.</p> <p>Core and remove the seeds of the peppers and cut them into quarters.</p> <p>Divide the mince mixture between these quarters and arrange the peppers in an oven proof dish</p> <p>Cook in a preheated oven at 200C for about 25 minutes then transfer to a serving dish and serve immediately.</p> <p><a href="menu.html" class="pg75">Back to the main menu</a></p> </div>
#pg75_smallbox { background-image: url("chpt3/boxbg.gif"); background-repeat: repeat-x; float: left; margin-right: 20px; width: 220px; border: 1px solid #d2d7e4; } #pg75_smallbox h2 { margin: 0; padding: 0.2em; background-image: url("chpt3/boxheaderbg.jpg"); background-repeat: no-repeat; color: #FFFFFF; background-color: red; font-size: 140%; font-weight: normal; } #pg75_content { margin: 2em 4em 2em 4em; background-color: #FFFFFF; padding: 1em 1em 40px 1em; background-image: url("chpt3/tick.gif"); background-repeat: no-repeat; background-position: bottom right; } h1.pg75_header { background-image: url("chpt3/dotty.gif"); background-repeat: repeat-x; background-position: bottom left; padding: 0 0 6px 0; color: #41667f; font-size: 160%; font-weight: normal; background-color: transparent; } a.pg75:link, a.pg75:visited { color: #41667f; background-color: transparent; padding-right: 10px; } a.pg75:hover { background-image: url("chpt3/arrow.gif"); text-decoration: none; background-position: center right; background-repeat: no-repeat; }
图3-4
6. 为页面设置多个背景图片
<div id="content"> <h1 class="header">Chinese-style stuffed peppers</h1> <div id="smallbox"> <ul> <li>1 tablespoon of oil</li> <li>1 crushed garlic clove</li> <li>Peeled and finely chopped fresh ginger root</li> <li>250g minced pork, beef or Quorn</li> <li>1 chopped spring onion</li> <li>1 chopped celery stick</li> <li>Grated rind of 1 lemon</li> <li>Finely chopped red chilli (optional)</li> <li>4 large green peppers</li> </ul> </div> <p>These stuffed peppers are lovely as a starter, or as a side dish for a Chinese meal. They also go down well as part of a buffet and even children seem to like them.</p> <p>Heat the oil in a wok. Add the garlic and stir fry until golden.</p> <p>Reduce the heat down and then add the ginger and the mince. Stir fry until this is nicely browned then add the other ingredients (apart from the peppers). Stir fry all of this together for a minute, then remove from the heat and allow to cool slightly.</p> <p>Core and remove the seeds of the peppers and cut them into quarters.</p> <p>Divide the mince mixture between these quarters and arrange the peppers in an oven proof dish</p> <p>Cook in a preheated oven at 200C for about 25 minutes then transfer to a serving dish and serve immediately.</p> <p><a href="menu.html">Back to the main menu</a></p> </div>
html { background-image: url(chpt3/background-repeatx.jpg); background-repeat: repeat-x; background-color: #d2d7e4; } body { font: 0.9em Verdana, Geneva, Arial, Helvetica, sans-serif; color: #000000; background-image: url(chpt3/recipes.png); background-repeat: no-repeat; background-position:98% 2%; background-attachment:fixed; margin: 0; padding: 46px 0 0 0; } #smallbox { background-image: url(chpt3/boxbg.gif); background-repeat: repeat-x; background-color: #FFFFFF; float: left; margin-right: 20px; width: 220px; border:1px solid #d2d7e4; } #content { margin: 0 4em 2em 4em; background-image: url(chpt3/opaque.png); padding: 1em 50px 40px 1em; } h1 { padding: 0 0 6px 0; color: #41667f; font-size: 160%; font-weight: normal; background-color: transparent; } a:link, a:visited { color: #41667f; background-color: transparent; padding-right: 10px; } a:hover { background-image: url(chpt3/arrow.gif); text-decoration: none; background-position: center right; background-repeat: no-repeat; }
图3-5
7. 如何在页面上使用透明色
把你的图片保存为24位PNG格式,就可以生成真正的透明图片。但是IE6不支持Alpha通道图像,所以不能渲染透明PNG图片。在第7章对如何在IE6中实现透明背景做进一步阐述。
<div id="content"> <h1 class="header">Chinese-style stuffed peppers</h1> <div id="smallbox"> <ul> <li>1 tablespoon of oil</li> <li>1 crushed garlic clove</li> <li>Peeled and finely chopped fresh ginger root</li> <li>250g minced pork, beef or Quorn</li> <li>1 chopped spring onion</li> <li>1 chopped celery stick</li> <li>Grated rind of 1 lemon</li> <li>Finely chopped red chilli (optional)</li> <li>4 large green peppers</li> </ul> </div> <p>These stuffed peppers are lovely as a starter, or as a side dish for a Chinese meal. They also go down well as part of a buffet and even children seem to like them.</p> <p>Heat the oil in a wok. Add the garlic and stir fry until golden.</p> <p>Reduce the heat down and then add the ginger and the mince. Stir fry until this is nicely browned then add the other ingredients (apart from the peppers). Stir fry all of this together for a minute, then remove from the heat and allow to cool slightly.</p> <p>Core and remove the seeds of the peppers and cut them into quarters.</p> <p>Divide the mince mixture between these quarters and arrange the peppers in an oven proof dish</p> <p>Cook in a preheated oven at 200C for about 25 minutes then transfer to a serving dish and serve immediately.</p> <p><a href="menu.html">Back to the main menu</a></p> </div>
html { background-image: url(chpt3/background-repeatx.jpg); background-repeat: repeat-x; background-color: #d2d7e4; } body { font: 0.9em Verdana, Geneva, Arial, Helvetica, sans-serif; color: #000000; background-image: url(chpt3/recipes.png); background-repeat: no-repeat; background-position:98% 2%; background-attachment:fixed; margin: 0; padding: 46px 0 0 0; } #smallbox { background-image: url(chpt3/boxbg.gif); background-repeat: repeat-x; background-color: #FFFFFF; float: left; margin-right: 20px; width: 220px; border:1px solid #d2d7e4; } #content { margin: 0 4em 2em 4em; background-image: url(chpt3/opaque.png); padding: 1em 50px 40px 1em; } h1 { padding: 0 0 6px 0; color: #41667f; font-size: 160%; font-weight: normal; background-color: transparent; } a:link, a:visited { color: #41667f; background-color: transparent; padding-right: 10px; } a:hover { background-image: url(chpt3/arrow.gif); text-decoration: none; background-position: center right; background-repeat: no-repeat; }
图3-6
(第三章 完)
发表评论
-
CSS float属性
2012-03-03 15:06 531下面http://www.w3school.com.cn对fl ... -
CSS文集(The CSS Anthology) 第四章 导航菜单栏
2012-02-18 23:38 0【占位符】 -
CSS文集《The CSS Anthology》 第二章 文本格式化及其它基础知识 (2)
2012-02-18 19:46 108911. 为段落文本加高亮 <div> &l ... -
The CSS Anthology 第五章 Tabular Data (表格式数据)
2012-02-15 13:25 0[ PLACEHOLDER ] -
The CSS Anthology 第四章 Navigation导航栏(导航菜单)
2012-02-15 13:24 0[ PLACEHOLDER ] -
CSS文集《The CSS Anthology》 第二章 文本格式化及其它基础知识 (1)
2012-02-15 13:25 899第二章 文本格式化及其它基础知识(Text Styling a ... -
Web-Harvest: Set a Proxy Server
2011-06-09 11:36 1087InputSource is = new InputSourc ... -
Beanshell : Setting variables in WebHarvest scripts
2011-06-09 11:34 1827print("sys.isVariableDefin ... -
ExceptionUtils : A very useful class from apache commons
2011-06-09 11:23 901apache.commons.lang Exceptio ... -
调试内嵌的javascript
2011-06-09 11:22 765调试诸如: document.write('<scri ... -
JProfiler : 用JProfiler可以很容易发现Blocked掉的线程。
2011-06-09 11:20 832As title. -
WH : && => &&
2011-06-09 11:12 701<if condition="${ ( ... -
Web-Harvest: variables!!
2011-06-09 11:11 746Getting sized of a list ... -
Spring WebContextApplication
2011-06-09 11:11 664问题: Closing WebContextAppl ... -
Cygwin
2011-06-09 11:10 611在Windows下使用Linux中的常用工具!! -
eclipse : XXX cannot be resolved to a type
2011-06-09 11:09 1168Go to: [Project] \ [Clean.. ... -
GOOD practice : 字符串比较
2011-06-09 11:09 682对于字符串的比较和打印 一定要额外加引号 输出!! -
Spring : 隐藏的依赖
2011-06-09 11:09 639可以在 Bean 定义上加 attribute: &q ... -
Linux : 生成随机密码
2011-06-09 11:08 920生成 6 位随机密码 $ echo `< ... -
twitter : 搜索中文关键字时每个中文字要用空格分开
2011-06-09 11:07 815如题。
相关推荐
综上所述,《THE CSS3 ANTHOLOGY:第四版》是网页设计师和前端开发者的宝贵资源,它不仅提供了关于CSS3的详尽教程,而且在编排和内容更新上保持了与行业标准同步。通过学习本书,可以有效提升网站设计与开发的专业...
3. **第3章:图像和其他设计元素** - **图像处理**:介绍如何使用CSS来调整图像的大小、位置以及添加边框效果。 - **背景图片**:讲解如何使用背景图片属性来设置元素的背景。 - **SVG图形**:探讨如何使用SVG...
The CSS Anthology: 101 Essential Tips, Tricks & Hacks is a compilation of best practice solutions to the most challenging CSS problems. The third edition of this best-selling book, published in full ...
### CSS Anthology: 101 Essential Tips, Tricks & Hacks (2009) — 知识点解析 #### 一、概述 《CSS Anthology: 101 Essential Tips, Tricks & Hacks》是一本由SitePoint Pty Ltd于2009年出版的专业CSS书籍,作者...
本章提供了资源和建议,帮助开发者跟上JavaScript和Web开发领域的最新趋势和发展。 通过深入研究这些章节,读者将获得全面的JavaScript知识,能够应对各种编程挑战,并创造出功能强大、用户体验优秀的Web应用程序。
3. **CSS操作**:JavaScript也可以用来动态改变页面样式,书中的CSS部分将教你如何使用JavaScript操作CSS属性,实现动态样式变化,如响应式设计或动画效果。 4. **AJAX**:异步JavaScript和XML(AJAX)是现代Web...
《The.CSS.Anthology.2nd.Edition.Aug.2007.pdf》可能是该书的电子版,其中包含详细的章节和示例代码。"说明.txt"文件可能包含了阅读和使用电子版的指南,或者是一些额外的补充信息。 通过阅读这本书,读者不仅可以...
12. **CSS框架和设计模式**:如《CSS Anthology》、《O'Reilly CSS: The Definitive Guide》等,这些书籍提供了CSS的最佳实践和常见设计模式,帮助开发者写出更高效、可维护的CSS代码。 综上所述,HTML和CSS开发...
- **第3章:The Loop and WordPress FileSystem** - **知识点简介**:详细介绍WordPress中的查询循环(The Loop)及文件系统的组织结构。 - **核心内容**: - The Loop的运行机制及其在主题开发中的应用; - ...
《JavaScript Anthology:101 Essential Tips, Tricks & Hacks》是一本由James Edwards和Cameron Adams编写的经典JavaScript教程书籍。该书由SitePoint Pty. Ltd. 出版,首次出版于2006年2月,并在同年12月进行了...
The WordPress Anthology puts you in the driver’s seat of this powerful & flexible open-source CMS, offering an extensive array of solutions for your projects. Jam-packed with proven tips & techniques...
3. **Working with Windows and Frames(操作窗口和框架)**: - 窗口对象的属性和方法。 - 如何创建新窗口以及与其交互。 - 框架集的使用技巧。 - 跨框架脚本编写的方法。 4. **Basic Dynamic HTML(基本动态...
### 《ThoughtWorks Anthology:软件技术与创新论文集》核心知识点提炼 #### 一、概述 《ThoughtWorks Anthology:软件技术与创新论文集》是一本汇集了ThoughtWorks工程师们在软件技术与创新领域多年积累的经验与...
标题和描述中提到的《Memory Dump Analysis Anthology, Volume 3 内存分析技术》是关于内存转储分析的一系列作品中的一卷。这部作品由Dmitry Vostokov编辑,并由Software Diagnostics Institute出版,属于《Memory ...
《Memory Dump Analysis Anthology》很显然是一份深入探讨这一主题的专业文献,包含两卷PDF文档,可能涵盖了从基础知识到高级技巧的全面内容。 内存dump,又称为内存转储或内存快照,是在操作系统或应用程序遇到...