Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3 Columns - Force non breaking/splitting element?

Tags:

css

I'm using some CSS3 columns (column-count: 2;column-gap: 20px;) to split some content into two columns. In my content I have a <p>, followed by a <blockquote>, followed by another <p>.

My question: Is there a way of preventing my <blockquote> (or any other specified element) from splitting into two columns?

For example, currently my <blockquote> is partially in column 1, and partially in column 2.

Blockquote split onto multiple columns

Ideally I'd like to make it so the <blockquote> stays together in either column 1 or 2.

Blockquote maintained in column

Any idea if this can be achieved?

Thanks!

like image 747
Probocop Avatar asked Dec 14 '11 15:12

Probocop


People also ask

How do you prevent column breaks in an element?

We can prevent column break within an element by using a CSS break-inside Property. The break-inside property in CSS is used to specify how the column breaks inside the element. Sometimes content of an element is stuck between the column. To prevent column break we should use the break-inside Property set to avoid.

What are the CSS properties that are used to manage column breaks?

The break-inside property specifies whether or not a page break, column break, or region break should occur inside the specified element. The break-inside property extends then CSS2 page-break-inside property.


1 Answers

Add display:inline-block; to the item you want to prevent from splitting.

like image 180
bookcasey Avatar answered Oct 16 '22 02:10

bookcasey