html网页设计中加横线,HTML:让网页超链接拥有多姿多彩的下划线(2)-网页设计,HTML/CSS...

二、实例欣赏

假设有两个下划线图形diagonal.gif(波纹线)、flower.gif(花朵)前者的高、宽是3、9,后者的高、宽是11、15。下面是一个设置两种下划线的完整实例:

自定义链接下划线示例

网页源代码如下:注:diagonal.gif 和 flower.gif已经先拷贝到网页所在的同一目录下。

网页源代码如下:注:diagonal.gif 和 flower.gif已经先拷贝到网页所在的同一目录下。

〈html〉

〈head〉

〈title〉ex〈/title〉

〈style type=”text/css”〉

a#example1a {

text-decoration: none;

background: url(diagonal.gif) repeat-x 100% 100%;

white-space: nowrap;

padding-bottom: 2px;

}

a#example1b {

text-decoration: none;

white-space: nowrap;

padding-bottom: 2px;

}

a#example1b:hover {

background: url(diagonal.gif) repeat-x 100% 100%;

}

a#example2a {

text-decoration: none;

background: url(flower.gif) repeat-x 100% 100%;

white-space: nowrap;

padding-bottom: 10px;

}

a#example2b {

text-decoration: none;

white-space: nowrap;

padding-bottom: 10px;

}

a#example2b:hover {

background: url(flower.gif) repeat-x 100% 100%;

}

–〉

〈/style〉

〈/head〉

〈body〉

〈p〉实例:〈/p〉

〈p〉 〈a href=”#” id=”example1a”〉波纹线静态下划线〈/a〉,

〈a href=”#” id=”example1b”〉鼠标停留时出现的波纹线〈/a〉。〈/p〉

〈p〉 〈a href=”#” id=”example2a”〉花朵静态下划线〈/a〉,

〈a href=”#” id=”example2b”〉鼠标停留时出现的花朵下划线〈/a〉。〈/p〉

〈/body〉

〈/html〉

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以使用以下 HTMLCSS 代码来创建一个带搜索图标的搜索框: HTML 代码: ```html <div class="search-box"> <form action="/search" method="get"> <input type="text" placeholder="Search..."> <button type="submit"><i class="fa fa-search"></i></button> </form> </div> ``` CSS 代码: ```css .search-box { display: flex; justify-content: center; align-items: center; margin: 20px; } input[type="text"] { padding: 10px; border: none; border-radius: 5px 0 0 5px; width: 200px; font-size: 16px; } button[type="submit"] { padding: 10px 15px; background-color: #4CAF50; border: none; border-radius: 0 5px 5px 0; color: white; font-size: 16px; cursor: pointer; } i.fa.fa-search { font-size: 16px; margin-right: 5px; } ``` 这里的 HTML 代码中包含一个名为 `search-box` 的 div 元素,用于设置搜索框的样式。在 div 元素内部,使用了 form 元素和 input 元素来创建搜索框,使用了 button 元素和 i 元素来创建搜索按钮和搜索图标。`placeholder` 属性提供了默认的提示文本,`name` 属性指定了提交的参数名称。 CSS 代码中使用了 `display: flex` 属性和 `justify-content: center` 和 `align-items: center` 属性来将搜索框水平居中。`border-radius` 属性用于设置输入框和按钮的圆角,`padding` 属性用于设置输入框和按钮的内边距,`width` 属性用于设置输入框的宽度。`background-color` 属性用于设置按钮的背景颜色,`color` 属性用于设置按钮的文字颜色,`cursor` 属性用于设置鼠标悬停时的光标类型。`fa` 和 `fa-search` 类名用于引用 Font Awesome 图标库中的搜索图标样式。 请注意,这里使用了 Font Awesome 图标库,您需要在页面中引入该库的 CSS 样式文件,例如: ```html <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值