CSS PDF - Styling by ID

CarlosM
Posts: 1

CSS PDF - Styling by ID

Thu Jul 12, 2018 7:52 pm

Is it possible to select the attribute to style content. I have an ID in a reference and I cannot style it. I tried setting my selector for the reference/reference class and that worked, but it selected all references. Then I tried this:

Code: Select all

*[class~="reference/reference"][id~="reference_a7Hj8K1"]{

    background-color: red;

}


That also did not work. Is this a bug or am I crazy?

Thanks!
Costin
Posts: 365

Re: CSS PDF - Styling by ID

Thu Jul 12, 2018 9:13 pm

Hi CarlosM,

What version of oXygen are you using? Are you on the last version available?
Also, what specific transformation scenario are you applying? Is it DITA Map PDF - based on HTML5 and CSS, or the DITA Map PDF - based on DITA and CSS (WYSIWYG)?
Also, what type of reference do you have? Is it a conref / xref (with href or keyref)?

It would help us investigate if you could send a sample DITA Map in a minimal form rhat reproduces the issue on our support email - support@oxygenxml.com (together with your CSS file).

Meanwhile, you could try using the outputclass attribute instead the ID.
More specific, on the reference (conref / xref element), you should set an "outputclass" attribute, which you could then match the resulted class in the output through your customization CSS and style it as you wish.
For example:
- in your source dita file you could have

Code: Select all

<p conref="your/referred#content" outputclass="reference1">Referred content</p>
or

Code: Select all

<xref keyref="your/referred/content" outputclass="reference1"></xref>

- in your CSS, in case you use the HTML5 and CSS scenario, you should use

Code: Select all

*[class~="reference1"]{
    background-color: red;
    color: cyan;
}

and for the DITA and CSS (WYSIWYG), the selector would slightly change in:

Code: Select all

*[outputclass~="reference1"]
.

I hope this helps!
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Radu
Posts: 5563

Re: CSS PDF - Styling by ID

Fri Jul 13, 2018 7:42 am

Hi,

Also whenever you try to style content using CSS it will help you if you know exactly the merged XML document over which the CSS is applied:

https://www.oxygenxml.com/doc/versions/20.1/ug-editor/topics/dcpp_debugging_the_css.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests