I'm modifying a WordPress theme that's built upon Bootstrap and would like to get content that will appear in one div to be distributed over two even height columns. Can this easily be done via the Bootstrap framework or CSS?
Thanks.
What you can do is use some of the new CSS3 elements.
Please note that this will only work on the latest browsers and in most cases will require browser prefix's
div {
-webkit-column-count: 2;/* Chrome, Safari, Opera */
-moz-column-count: 2;/* Firefox */
column-count: 2;
}
<div>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex
ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue
duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
</div>
As you can see, you have to call the browser specific calls for webkit and moz. There's a lot of extra functionality about setting widths and other such information so reading some docs on it will be useful.
Below are a couple of links about how to usage and where its supported
Read more: MDN
Browser support: Caniuse
this is the only available solution with bootstrap :
LIVE DEMO
<div class="row">
<div class="col-md-6 col-xs-6 col-lg-6 lol1">somethink</div>
<div class="col-md-6 col-xs-6 col-lg-6 lol2">somethink</div>
</div>
if the content of your div is a text you can't manage to display this content in two column , you have to use other div's inside this container .
Related
I want to make a login page like flickr website. I tried to learn how they designed it and the conclusion was they made a div autoscroll. My question is how to make a div auto scrollable on page load. And if there is any other way to achieve the same design then share.
I don't know what flickr is but this is an auto scrolling div curtesy of sitepoint: https://www.sitepoint.com/community/t/auto-scrolling-a-div-with-overflow-scroll-auto/2291 I imagine it would be easy enough to bend this to what you are looking for, make it horizontal etc.
<body>
<div id="ecran" style='overflow:auto;width:200px;height:200px;border:solid 1px green;'>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</div>
<script type='text/javascript'>
function ScrollDiv(){
if(document.getElementById('ecran').scrollTop<(document.getElementById('ecran').scrollHeight-document.getElementById('ecran').offsetHeight)){-1
document.getElementById('ecran').scrollTop=document.getElementById('ecran').scrollTop+1
}
else {document.getElementById('ecran').scrollTop=0;}
}
setInterval(ScrollDiv,50)
</script>
</body>
Instead of having a scroll bar I want to move it to the next column, Is it possible with WebView control?
See the image below:
The content with "Red Box" I want to move it to the second column.
XAML CODE:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="500" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" />
<WebView Grid.Row="1" Width="410" local:WebViewProperties.HtmlString="{Binding Description}"></WebView>
How to render Multi Column WebView instead of having vertical scroll bar
WebView can not render your HTML content to multi columns. And also this should not be done by the WebView control. You should be able to set the HTML content to multi columns by CSS style. For example,the following newspaper div is showed as two columns.
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
</style>
</head>
<body>
<p><b>Note:</b> Internet Explorer 9, and earlier versions, does not support the column-count property.</p>
<div class="newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
</div>
</body>
</html>
More details please reference CSS3 Multiple Columns. Updating the HTML layout to what you want by HTML elements or CSS style then render them.
I want to create simple toggle button, that will expand/hide text paragraph. I wan't to use as little javascript as possible.
I tried it this way: Fiddle
The problem occurs when I want to hide expanded content. The content will be hidden after an unwanted delay - When user clicks the button the animation won't start immediately. I have tried it in chrome and firefox. In both I get the same behaviour.
Can someone explain me why is my code behaving this way and how to fix it?
Here is source code that is identical to the one in the fiddle link:
HTML:
<div class="container">
<h1 class="header">Header</h1>
<p class="content">
content
</p>
toggle
</div>
CSS:
.content {
max-height: 0;
overflow: hidden;
transition: max-height 1s ease-in-out;
}
.expanded .content {
max-height: 1000px;
}
Javascript:
var $container = $('.container');
$('.toggle').click(function() {
$container.toggleClass('expanded');
});
Add min-height instead:
.content {
max-height: 0;
overflow: hidden;
transition: min-height 1s ease-in-out;
}
.expanded .content {
min-height:20px;
}
Use min-height rather than max-height.
When you click 'toggle' and the div is expanded, the height of the div is reduced in 2 steps... first to it's "auto" height, then to the max-height in the original class. So what looks like a delay is actually 2 steps of height reduction.
max-height: is not an absolute value, it's ambiguous unless the content itself forces the height to be greater. The script has to calculate what the actual height is upon the transition then determine if it is greater than the max-height setting which is being transitioned to.
You can see this by just adding a defined height to the expanded class:
var $container = $('.container');
$('.toggle').on('click', function() {
$container.toggleClass('expanded');
});
.content {
max-height: 0px;
overflow: hidden;
background: #ddd;
transition: max-height .2s ease-in-out;
}
.expanded .content {
max-height: 300px;
height: 150px;
background: #ddd;
transition: max-height .2s ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<p class="content">
content
</p>
toggle
</div>
If your content is actually greater and it causes the div to be taller than the max-height value, you won't have this problem. It's only an issue when the original height is less than the max-height value in the transition.
var $container = $('.container');
$('.toggle').on('click', function() {
$('.container').toggleClass('expanded');
});
.content {
max-height: 0px;
overflow: hidden;
background: #ddd;
transition: max-height .2s ease-in-out;
}
.expanded .content {
max-height: 1000px;
background: #ddd;
transition: max-height .2s ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<p class="content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
</p>
toggle
</div>
If you adjust and use min-height you get a smooth transition. You also need to add height: 0; to the main class to completely hide the div on collapse.
var $container = $('.container');
$('.toggle').on('click', function() {
$container.toggleClass('expanded');
});
.content {
min-height: 0px;
height: 0;
overflow: hidden;
background: #ddd;
transition: min-height .2s ease-in-out;
}
.expanded .content {
min-height: 150px;
background: #ddd;
transition: min-height .2s ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<p class="content">
content
</p>
toggle
</div>
Here's an image of what I'm trying to accomplish: http://i.imgur.com/XKPuV.png
I want an outside container with a border and an inner container with a gray background. Within the inner container are two blocks: text on the left, image on the right (the elements on either side are of no importance - they can be whatever). Pretty basic stuff.
With the code below, I have my two div's that span 6 columns breaking apart (Here's what it looks like: http://i.imgur.com/BEIVl.png). What's the best way to fix this issue?
<div class="container" style="border: 1px solid gray;height:490px;margin-top:20px;">
<div id="inner-container" style="background:gray;margin:5px;">
<div class="row">
<div class="span6">
<p style="margin:5px;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</p>
</div>
<div class="span6">
<p style="margin:5px;">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</p>
</div>
</div>
</div>
The problem is that you can't specify inline margins and paddings with spanX classes, as these in override boostrap's own padding/margin settings (this is why the 2nd div goes on the next line.
I suggest that you create what you need without using spanX definitions for inner divs. See fiddle: http://jsfiddle.net/periklis/KGMEF/1/
I have a table with three columns in which I'm trying to get some long paragraphs to flow dynamically from the first column into the second and then into the third. Currently, the table will continue on a next page when the first column overflows instead of moving into the second column and so I get several pages filled with only a single column's worth of data. How can I fix this?
It can be done with CSS3 but most browsers does not support those properties yet.
Link here: Multi-column layout
There is also a jQuery plugin for this.
http://code.google.com/p/js-columns/
EDIT 2016
The column-count CSS property for multi-column layouts is supported by all major browsers (http://www.w3schools.com/css/css3_multiple_columns.asp).
Demo:
.newspaper {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
<p><b>Note:</b> Internet Explorer 9, and earlier versions, does not support the column-count property.</p>
<div class="newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.
</div>