Creating CSS Buttons (二)
日期:2007年6月6日 作者: 查看:[大字体 中字体 小字体]-
A Css Button Creation Class
IntrodUCtion
In an earlier article, Creating CSS Buttons, I examined how to create graphical-appearing buttons using nothing but HTML and CSS. While this approach is fairly simple to implement - just add a few style tags and a suitable HREF and DIV tag - it is a bit mundane to have to do for each and every button, especially since you need to have a unique set of style classes and IDs for each unique button. (If you are thoroughly confused by this point, be sure you've read the Creating CSS Buttons article before delving into this one...) In this article we will examine a small, but handy class to help automate the process of creating CSS buttons. Furthermore, when using a class we'll be creating and placing buttons much like you would in a VB project. (For more information on creating and using classes in VBScript, be sure to read Mark Lidstone's Excellent article: Using Classes within VBScript!)
Determining the Class Properties
The first step in creating our CSS button creating class is to decide what properties makeup a CSS button. While there is literally no limit to the number of properties one could conceivably attribute to a button, for this article I am going to assume that this set of properties conveys the basic features one would like to have in a button:
CSSButton Class Properties
Name Uniquely identifies each button.
BackColor Specifies the background color of the button.
BorderColor Specifies the color of the button's border.
Font The font to use for the button's label. Must be in the format: style size font-name, such as: bold 12pt arial.
FontColor The color of the font when the button is not selected.
Width The width of the button.
Text The text to display on the button.
Url The Url to take the user to when the click the button.
MouseOverColor The color to make the font when the user's mouse moves over the button.
This will only work for visitors using IE...
These properties describe each button. Realize that you must use a unique Name for each independent button you want on a given Web page. If you create multiple buttons with the same name, when you mouse over one button, all of those buttons will highlight.
Creating the Class Methods
Now that we've looked at the properties for the CSSButton class, let's examine the two methods we'll need: GenerateStyleTag() and GenerateButtonTag(). Since each CSS button needs its own classes/IDs declared in a STYLE tag, and, additionally, needs an HREF/DIV section to display the button, these two methods return the applicable STYLE tag and HTML. These methods are very simple, and can be seen below:
Public Function GenerateStyleTag()
'Create the STYLE tag
Dim strStyle
strStyle = "<STYLE TYPE=""text/CSS"">" & vbCrLf & _
"<!--" & vbCrLf & _
"#mybutton" & Name & " {border-style: inset; " & vbCrLf & _
" border-color: " & BorderColor & ";" & vbCrLf & _
" background-color: " & BackColor & ";" & vbCrLf & _
- [1] [2] [3] [4] 下一页
-
- Creating CSS Buttons (二) 相关文章:
- ·Creating CSS Buttons (二)
- Creating CSS Buttons (二) 相关软件
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
上一篇:CSS 制作的三级菜单特效代码
下一篇:CSS:font-weight
精品推荐
热点TOP10
- ·DIV+CSS布局入门实例教程
- ·创建一个纯CSS的水平导航条
- ·设计一个基于CSS的网页模板
- ·Javascript+CSS横向三级导航菜单
- ·站长推荐:53个CSS-不可或缺的技巧
- ·如何使用CSS来进行网页排版
- ·CSS文本:word-wrap
- ·彻底弄懂CSS盒子模式(DIV布局快速入门)
- ·网页设计基础:Div+CSS布局入门教程
- ·CSS中的滑动门技术
- ·使用CSS处理表格边框样式化
- ·DIV CSS网页布局导航菜单源代码(17)
- ·CSS文本:text-overflow
- ·总结:用CSS进行网页样式设计攻略全集
- ·DW MX 2004 CSS 属性详解
- ·小技巧:div+css高度自适应
- ·如何用css设置网页字体
- ·如何用CSS定义表格与模拟表格
- ·使用纯 CSS 设计3D按钮
- ·深入了解CSS的继承性及其应用
特别推荐
- ·CSS网站布局技巧几则总结
- ·彻底弄懂CSS盒子模式(DIV布局快速入门)
- ·CSS样式设计之CSS滤镜资料小结
- ·总结:用CSS进行网页样式设计攻略全集
- ·创建一个纯CSS的水平导航条
- ·如何用css设置网页字体
- ·CSS中的滑动门技术
- ·Javascript+CSS横向三级导航菜单
- ·CSS文本:word-wrap
- ·用CSS进行网页样式设计攻略全集
- ·用CSS实现的固定表头的HTML表格
- ·CSS属性列表
- ·如何使用CSS来进行网页排版
- ·使用纯 CSS 设计3D按钮
- ·纯CSS制作简洁的垂直导航
- ·网页设计基础:Div+CSS布局入门教程
- ·CSS 制作的三级菜单特效代码
- ·设计一个基于CSS的网页模板
- ·如何用CSS定义表格与模拟表格
- ·用CSS制作的美国国旗
