html代码能设置成虚线吗?

html代码能设置成虚线吗?,第1张

标签本身属性只有align、noshade、size、width;\x0d\x0a并不包含线的样式,要想展示为虚线,只能通过css实现;\x0d\x0a例如:\x0d\x0a \x0d\x0a\x0d\x0a注:dashed就表示虚线;其它选择还有none:无样式;dotted:点线;solid:实线;double:双线;groove:槽线;ridge:脊线;inset:内凹;outset:外凸。

虚线是css控制的

在<style></style>中添加

.bor{

border-bottom: 1px dashed #000

}

在需要添加虚线的元素添加 class="border"

p标签跟这个也差不多,只是添加的属性不一样

background: #颜色代码

具体有两种方法:

1、画虚线的图,然后插入网页中。缺点是这个虚线不能随意变动大小,因为拉伸图片会产生失真。

2、编程<div style="width:200pxheight:0pxborder-top:1px black dashed" />。缺点,不能改变方向。

还可以用svg,可以随意改变大小,粗细,方向,例子如下:

<html>

<head>

</head>

</head>

<body>

<svg

xmlns:dc="http://purl.org/dc/elements/1.1/"

xmlns:cc="http://creativecommons.org/ns#"

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

xmlns:svg="http://www.w3.org/2000/svg"

xmlns="http://www.w3.org/2000/svg"

version="1.1"

width="500"

height="500"

id="svg2">

<defs

id="defs4" />

<metadata

id="metadata7">

<rdf:RDF>

<cc:Work

rdf:about="">

<dc:format>image/svg+xml</dc:format>

<dc:type

rdf:resource="http://purl.org/dc/dcmitype/StillImage" />

<dc:title></dc:title>

</cc:Work>

</rdf:RDF>

</metadata>

<g

transform="translate(0,-552.36218)"

id="layer1">

<path

d="m 68.571428,651.6479 239.999992,0"

id="path2985"

style="fill:nonestroke:#000000stroke-width:1stroke-linecap:buttstroke-linejoin:miterstroke-miterlimit:4stroke-opacity:1stroke-dasharray:1, 3stroke-dashoffset:0" />

</g>

</body>

</html>

缺点是不能直接在IE里用,火狐、Chrome等都没问题。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6284590.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-19
下一篇 2023-03-19

发表评论

登录后才能评论

评论列表(0条)

保存