Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve disorganised bubble layout with html css?

Tags:

html

css

I need to have a bubble layout like this:

enter image description here

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!

like image 728
Lakshay Avatar asked Jun 28 '15 10:06

Lakshay


People also ask

How do you make a bubble in HTML?

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.

How do you split a layout in HTML?

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.

How do I put Textboxes side by side in HTML?

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.


1 Answers

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;">&nbsp;</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>
like image 192
pokeybit Avatar answered Oct 18 '22 02:10

pokeybit