XSL-FO : 带有背景色的空行内块 [英] XSL-FO : empty inline block with background color

查看:18
本文介绍了XSL-FO : 带有背景色的空行内块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有某种颜色的空内联块,但是如果 <fo:inline> 元素没有任何内容,则它不起作用.

I want to create an empty inline block with some color in it, but if the <fo:inline> element doesn't have any content then it doesn't work.

对于下面包含的代码段,背景颜色为红色的代码段不起作用.

For the snippet included below, the one with the background color red doesn't work.

创建表格并为表格单元格提供背景颜色来解决这个问题将是我最后的选择.没有桌子我怎么办?

Creating a table and giving a table cell a background color to solve this would be my last option. How can I do it without a table?

<fo:block>
  <fo:inline background-color="black" padding-left="2pt" padding-right="2pt" margin-right="22pt" color="white">MY_SKU</fo:inline>
  <fo:inline background-color="red" margin-right="22pt" width="7pt" height="7pt"></fo:inline>
  <fo:inline>Red</fo:inline>
</fo:block>

我想要这样:

推荐答案

这是您想要实现的目标吗?

Is this what you are looking to achieve?

<fo:block>
  <fo:inline background-color="red" margin-right="22pt" width="7pt" height="7pt">
    <fo:inline background-color="black" padding-left="2pt" padding-right="2pt" margin-right="22pt" color="white">MY_SKU</fo:inline>
  </fo:inline>
  <fo:inline>Red</fo:inline>    
</fo:block>

这篇关于XSL-FO : 带有背景色的空行内块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆