This HTML and CSS code helps you to create a word cloud. It uses CSS transformations to style each keyword uniquely, making it helpful for showcasing your special words in a creative way.
You can integrate this code into your project to make tags cloud. Furthermore, you can customize the cloud by modifying CSS rules according to your needs.
How to Create Word Cloud in HTML and CSS
1. In your HTML file, start by creating an unordered list (<ul>
) with list items (<li>
) for each keyword you want to include in your word cloud. Each list item should have a class corresponding to the keyword it represents. Here’s an example:
<ul id="techList"> <li class="html5">html5</li> <li class="css3">css3</li> <li class="javascript">javascript</li> <li class="jquery">jquery</li> <li class="wordpress">wordpress</li> <li class="webstandards">web standards</li> <li class="accessibility">accessibility</li> <li class="usability">usability</li> <li class="seo">seo</li> <li class="responsive">responsive layout</li> <li class="ajax">ajax</li> <li class="objectoriented">object oriented</li> <li class="crossbrowser">cross browser</li> <li class="jg">j.g.</li> <li class="skills">skills</li> </ul>
2. Now, let’s style our word cloud using CSS. Create a <style>
block or link an external CSS file to your HTML file. Here’s a snippet of the CSS code:
@import url(https://fonts.googleapis.com/css?family=Oswald:400,700,300); #techList { position: relative; list-style: none; margin: 0; padding: 0; font-family: 'Oswald', sans-serif; font-size: 100%; text-transform: uppercase; color: #666; } #techList li { position: absolute; top: 0; left: 0; } .html5 { font-weight: 700; letter-spacing: -.05em; -webkit-transform: scale(7.5, 7.8) translate(1.18em, .68em); -moz-transform: scale(7.5, 7.8) translate(1.18em, .68em); } .javascript { letter-spacing: -.04em; font-weight: 400; -webkit-transform: scale(1.4) rotate(90deg) translate(3.88em, -13.2em); -moz-transform: scale(1.4) rotate(90deg) translate(3.88em, -13.2em); } .accessibility { letter-spacing: -.05em; font-weight: 300; -webkit-transform: scale(1.4, 1.33) rotate(90deg) translate(4.1em, -18.0em); -moz-transform: scale(1.4, 1.33) rotate(90deg) translate(4.1em, -18.0em); } .responsive { font-weight: 300; letter-spacing: -.03em; word-spacing: .3em; -webkit-transform: scale(2) translate(2.12em, 5.14em); -moz-transform: scale(2) translate(2.12em, 5.14em); } .usability { font-weight: 400; letter-spacing: -.04em; -webkit-transform: scale(2.85, 3) translate(7.14em, 3.55em); -moz-transform: scale(2.85, 3) translate(7.14em, 3.55em); } .ajax { letter-spacing: -0.01em; font-weight: 700; -webkit-transform: scale(2.4, 2.3) rotate(90deg) translate(6em, -5.8em); -moz-transform: scale(2.4, 2.3) rotate(90deg) translate(6em, -5.8em); } .css3 { letter-spacing: .01em; font-weight: 700; -webkit-transform: scale(6.8, 6.75) rotate(90deg) translate(1.32em, -4.54em); -moz-transform: scale(6.8, 6.75) rotate(90deg) translate(1.32em, -4.54em); } .jquery { letter-spacing: 0.045em; font-weight: 700; -webkit-transform: scale(3.88, 3.8) translate(5.42em, 3.72em); -moz-transform: scale(3.88, 3.8) translate(5.42em, 3.72em); } .objectoriented { font-weight: 700; letter-spacing: -.010em; -webkit-transform: scale(1.85, 1.9) translate(1.86em, 6.5em); -moz-transform: scale(1.85, 1.9) translate(1.86em, 6.5em); } .wordpress { font-weight: 300; letter-spacing: -0.05em; -webkit-transform: scale(2.75, 3) translate(1.72em, 4.95em); -moz-transform: scale(2.75, 3) translate(1.72em, 4.95em); } .seo { font-weight: 300; letter-spacing: -0.07em; -webkit-transform: scale(3.9, 4) translate(6.05em, .95em); -moz-transform: scale(3.9, 4) translate(6.05em, .95em); } .crossbrowser { font-weight: 700; letter-spacing: 0.1em; word-spacing: .2em; -webkit-transform: scale(2) translate(2.28em, 8.58em); -moz-transform: scale(2) translate(2.28em, 8.58em); } .webstandards { font-weight: 300; letter-spacing: 0em; word-spacing: .1em; -webkit-transform: scale(2) translate(12.7em, 8.6em); -moz-transform: scale(2) translate(12.7em, 8.6em); } .jg { color: #ee5d29; font-weight: 700; letter-spacing: -.03em; -webkit-transform: scale(3.4) translate(7.03em, 2.15em); -moz-transform: scale(3.4) translate(7.03em, 2.15em); } .skills { color: #ee5d29; font-weight: 700; letter-spacing: -.03em; -webkit-transform: scale(1.8) translate(9.95em, 9.55em); -moz-transform: scale(1.8) translate(9.95em, 9.55em); }
For each keyword class (e.g., .html5
), you can apply unique CSS transformations and styles to make them visually appealing. Experiment with different values to achieve your desired look.
Feel free to add more keywords to your word cloud or adjust the styling further to suit your preferences. Experiment with different transformations, colors, and fonts to make your word cloud truly unique.
That’s all! hopefully, you have successfully created Word Cloud using this HTML and CSS Code. If you have any questions or suggestions, feel free to comment below.
Similar Code Snippets:
I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences.
I truly enjoy what I’m doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.