0

我必须使用 ipyvuetify 突出显示在 jupyter 笔记本中使用 voila 呈现的文本。

为了实现这一点,我开始如下:

import ipyvuetify as vue
pp=vue.Html(tag='mark',style_='font-weight: bold', children=['this is the first text highlighted green'], background_color='green')
pp2=vue.Html(tag='mark',style_='font-weight: bold', children=['this is a second text highlighted red'], background_color='red')
pp3=vue.Html(tag='p',style_='font-weight: bold', children=['blueblue'], background_color='blue')
display(pp,pp2,pp3)

这会产生: 在此处输入图像描述

但期望的结果应该是: 在此处输入图像描述

4

1 回答 1

1

ipyvuetify.Html 没有属性“背景颜色”,也没有“颜色”。你可以通过'style_'标签设置背景颜色,就像你为粗体所做的那样。

import ipyvuetify as vue
pp=vue.Html(tag='mark',style_='font-weight: bold; background-color:green', children=['this is the first text highlighted green'])
pp2=vue.Html(tag='mark',style_='font-weight: bold; background-color:red', children=['this is a second text highlighted red'])
pp3=vue.Html(tag='p',style_='font-weight: bold; background-color:blue', children=['blueblue'])
display(pp,pp2,pp3)
于 2021-05-19T08:47:47.990 回答