I need to have a bubble layout like this:
I have completed the work till this stage - JsBin
As I am not that skilled in CSS/Web design, I can only think of using table tr td. But I can see I will need the bubbles to be aligned close to each other. If I go for table structure, I dont think it will work.
Please suggest some design structure, or I should go for other things, SVG, etc.
Thanks!
bubbles = []; Then we can create a bubble with arbitrary size and color with the following function. Noticed that the height and width are 2 times the size, in our scenario bubble. bubbleSize indicates the radius of the bubble, which is half of the width or height.
The div tag is known as Division tag. The div tag is used in HTML to make divisions of content in the web page like (text, images, header, footer, navigation bar, etc). Div tag has both open(<div>) and closing (</div>) tag and it is mandatory to close the tag.
The most common way to place two divs side by side is by using inline-block css property. The inline-block property on the parent placed the two divs side by side and as this is inline-block the text-align feature worked here just like an inline element does.
I hope this helps you :) I have fun with this. (Also check out this for some great reading / viewing http://paulbourke.net/texture_colour/randomtile/)
Demo: http://po0.co.uk/circles/
Uses: http://packery.metafizzy.co/
Code:
<style>
.circle
{
border-radius:50%;
text-align:center;
background:#efdeee;
display:inline-block;
margin:-5px;
}
</style>
<div id="container">
<?php
$xx = 1;
while ($xx <= 200) {
$thisx = rand(10,99);
echo '<div class="item circle" style="width:'.$thisx.'px;height:'.$thisx.'px;"> </div>';
$xx++;
}
?>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/packery/1.4.1/packery.pkgd.min.js"></script>
<script>
var container = document.querySelector('#container');
var pckry = new Packery( container, {
// options
itemSelector: '.item',
gutter: 10
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With