有没有任何方法来改变字体颜色在涂鸦与HTML后端?
(更具体地说,我想在库的手册中添加一个大的红色警告标签。)
发布于 2016-02-09 20:42:21
事实证明,您可以在不使用后端依赖解决方案的情况下直接在拼字中完成此操作。诀窍是使用具有样式的color-property。
使用elem设置样式,如图所示,您可以创建一个colorize函数,该函数设置文本的颜色。
(define (colorize #:color c . content)
(elem #:style (style #f (list (color-property c)))
content))然后你可以像这样用它:
@colorize[#:color "red"]{WARNING}还有background-color-property,你可以起诉设置文本的背景。
发布于 2016-01-20 16:44:23
正如Alexis所提到的,您可以使用一个与级联样式表( Cascading,CSS)配对的class,如下所示:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<!-- that's to link our styles to the webpage. -->
</head>
<body>
<!-- some time later... -->
<p class = "example">test</p>
<!-- the rest of the website -->在mystyle.css中
.example{ /* select all tags with the "example" class */
color: #FF0000; /* change font color using hex value */
background-color: #552222; /* change background color using hex value */
}现在,如果我们能够使用多个文件,这将是很棒的。但是,如果您想将所有信息都放在一个文件中,我们可以在一个<style>标记中发送相同的信息:
<head>
<!-- no need to link our styles, since they're embedded in the webpage. -->
</head>
<body>
<style>
.example{ /* select all tags with the "example" class */
color: #FF0000; /* change font color using hex value */
background-color: #552222; /* change background color using hex value */
}
</style>
<!-- some time later... -->
<p class = "example">test</p>
<!-- the rest of the website -->还有一种嵌入它的方法,但是你不应该使用它。永远不会。这永远是正确的方法。
如果您需要更多来自CSS方面的内容,请参见examples.asp。
发布于 2016-01-20 19:41:12
手动创建包含style属性的attributes结构似乎有效:
#lang scribble/base
@(require scribble/core
scribble/html-properties)
@para[#:style (style #f `(,(attributes '([style . "color:blue;"]))))]{blue text}https://stackoverflow.com/questions/34888125
复制相似问题