CSS property to span an element across multiple columns?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
mhd
Propeller Head
Posts: 23
Joined: Mon May 27, 2013 2:04 am
Location: Liège (Belgium)
Contact:

CSS property to span an element across multiple columns?

Post by mhd »

Hello everyone,
I have a 2-columns body frame in my page layout.
I would like my h1 to span across the two columns. Is it possible? Is there a CSS property to do that?
Thanks in advance for any hint.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: CSS property to span an element across multiple columns?

Post by kwag_myers »

It doesn't show up in the Stylesheet Editor, but you can add the following code to your CSS using NotePad (I've done this before with text shadowing):

Code: Select all

h1
{
column-span:all;
-webkit-column-span:all; /* Safari and Chrome */
} 
I got this from w3schools, and there's no support information on Firefox.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: CSS property to span an element across multiple columns?

Post by NorthEast »

This wouldn't work - CSS3 column styles aren't related to Flare's page layout columns.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: CSS property to span an element across multiple columns?

Post by LTinker68 »

mhd wrote:I have a 2-columns body frame in my page layout.
I would like my h1 to span across the two columns. Is it possible? Is there a CSS property to do that?
You'd have to create two topics. One is set to use the normal one-column page layout and the topic contains just your heading text. The second topic is set to use the two-column page layout and contains the main content for the "topic". You put both topics in the TOC. When the output is built, the two-column content immediately follows the heading text. To the end user they appear to be one topic.

Alternatively, you have a page layout used just for that content and you hard-code the heading text into a header or decoration frame, for example, perhaps on the Title or First page of the page layout. Your body frame is set to two columns and is positioned below that header frame, and your Normal or Right/Left pages have the two-columned body frame as well. I seem to recall that option has problems picking up the heading in the TOC, though, which is why I use the previous method.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: CSS property to span an element across multiple columns?

Post by NorthEast »

LTinker68 wrote:When the output is built, the two-column content immediately follows the heading text. To the end user they appear to be one topic.
This idea doesn't sound quite right - a single page in the output can't use/merge two different page layouts.


You can do this using a page layout if you have a two body frames in the layout. For example, add one body frame at the top of the page layout (the heading), and a then second body frame underneath which is set to use columns. In your stylesheet, set the heading style property frame-break-after to always. This means that the heading will appear in the top frame of the page layout, and the content following the heading will be put in the next frame in the layout (which has the columns).

If that solution is too rigid, and you need to have the headings/columns in different positions on the page, then an alternative is simply to lay this out using a table.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: CSS property to span an element across multiple columns?

Post by kwag_myers »

I'm just thinking out loud here (so to speak), but I wonder if you could apply a z-index to the heading so that it lays under/over the columns? You would also need to have a paragraph style with a margin-top value high enough to keep the text away from the heading.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: CSS property to span an element across multiple columns?

Post by LTinker68 »

Dave Lee wrote:
LTinker68 wrote:When the output is built, the two-column content immediately follows the heading text. To the end user they appear to be one topic.
This idea doesn't sound quite right - a single page in the output can't use/merge two different page layouts.
I didn't open my project in Flare, I just looked at the files in Windows Explorer. I saw two files, so that's how I thought I had it set up. I just opened the project in Flare, and now I can't figure out why I have it set up the way I do. I have a topic that has "Index" and an indexProxy, but it's pointing to a page layout with a two-column body. I have another topic that has just the indexProxy, but I don't have that topic in the TOC, so that must be left over from when I was trying to get this to work. The problem used to be that if the "Index" heading was in the two-column format, then the index entries in the second column used to start way up at the top of the second column, which put them even with my heading, which I didn't like. Somehow I either got it set up so that that doesn't happen, or Flare changed its behavior at some point so that the second column content doesn't go above the h1 tag.

Now I'm just confused. I don't know how I got that to work.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: CSS property to span an element across multiple columns?

Post by LTinker68 »

kwag_myers wrote:I'm just thinking out loud here (so to speak), but I wonder if you could apply a z-index to the heading so that it lays under/over the columns? You would also need to have a paragraph style with a margin-top value high enough to keep the text away from the heading.
I don't think z-index is supported in PDF outputs.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Post Reply