gpt4 book ai didi

html - 使用带有基本 HTML 的 HTML/CSS 的自定义边框

转载 作者:搜寻专家 更新时间:2023-10-31 21:49:35 25 4
gpt4 key购买 nike

我正在使用 TCPDF,它与普通的 HTML/CSS 有问题。它接受一组基本的 HTML/CSS,不幸的是没有什么特别的。

我需要一种方法来创建自定义虚线,如下所示:

enter image description here

看到 CSS 如何只有实线、虚线或点线的边框属性,我缺少虚线的“其他方式”。我需要能够控制笔画的长度,以及中间空间的长度。例如,笔划长度为 17,中间间距为 5。

我该怎么做?我可以这样做吗?

到目前为止,查看其他问题对我没有帮助。我已经阅读了一些问题,但到目前为止没有任何解决方案有帮助。它要么太花哨(tcpdf 忽略它),要么求助于破折号和虚线属性,而这些不足以满足我的目的。

最佳答案

TCPDF/tcpdf.php(主文件)中有一个名为 getCSSBorderDashStyle 的方法。您可以在那里设置不同的样式。

看起来像

switch (strtolower($style)) {
case 'none':
case 'hidden': {
$dash = -1;
break;
}
case 'dotted': {
$dash = 1;
break;
}
case 'dashed': {
$dash = 3;
break;
}
case 'double':
case 'groove':
case 'ridge':
case 'inset':
case 'outset':
case 'solid':
default: {
$dash = 0;
break;
}
}
return $dash;

通过更新 $dash 变量,您可以设置点/线之间的宽度和间距(随意调用)。 $dash = 2 它几乎与点边框相同。我在下面附上示例:

破折号 2 enter image description here破折号 5 enter image description here破折号 15 enter image description here破折号 50 enter image description here

您可以对此进行试验,可能会得到更接近预期的结果。我将它们设置在 PDF 的 css 中(在头部顶部)

<html>
<head>
<style type="text/css">
.dashed_div
{
border-bottom: 1px dotted #000;
width:100%;
text-align:right;
font-size: 12px;
}
...

关于html - 使用带有基本 HTML 的 HTML/CSS 的自定义边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25941681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com