Change background of rectangle without inner elements

Change background of rectangle without inner elements



I have concatenated rectangles like so:


usetikzlibraryfit, positioning
begintikzpicture
node [rectangle, draw, text width=4em, fill=white] (b) B;
node [rectangle, draw, text width=4em, right=of b, fill=white] (a) A;
node [rectangle, draw, fit=(b) (a), fill=orange, fill opacity=0.1] (local) ;
endtikzpicture



The result of the above is this:



enter image description here



My problem is that I do not want inner boxes A & B to have the orange background (i.e. they should not be coloured..). How can I fix this please? (still new to Tikz!)





Welcome to TeX.SE! Does adding fill=white to the inner nodes do what you want? node [rectangle, draw,text width=4em,fill=white] (b) B; and then fill the big node on the background layer.
– marmot
Sep 3 at 17:32



fill=white


node [rectangle, draw,text width=4em,fill=white] (b) B;





Thank you, no it does not work. I think because the last fill is overriding previous ones.. I have updated my code above to reflect this..
– ojenn
Sep 3 at 17:34





1 Answer
1



Too long for a comment.


documentclass[tikz,border=3.14mm]standalone
begindocument
usetikzlibraryfit, positioning,backgrounds
begintikzpicture
node [rectangle, draw,text width=4em,fill=white] (b) B;
node [rectangle, draw,text width=4em, right=of b,fill=white] (a) A;
beginscope[on background layer]
node [rectangle, draw, fit=(b) (a),fill=orange,fill opacity=0.1] (local) ;
endscope
endtikzpicture
enddocument



enter image description here





Of course. It was just asking me to wait..
– ojenn
Sep 3 at 17:54



Thanks for contributing an answer to TeX - LaTeX Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)