DEV Community

Cover image for How to Design HTML Without Coding Using CSS Generators and Tailwind
Ayan banerjee
Ayan banerjee

Posted on

How to Design HTML Without Coding Using CSS Generators and Tailwind

HTML is a standard marker language , the full form of HTML is Hyper text mark up language.HTML uses tag to design a page , multiple tags are available in HTML format , for example ‘DIV’ tag , ‘SPAN’ tag , for button or file upload , ‘input type=”button”’, ‘input type=”file”’

DIV tag example
<div id=’sampleDiv’ ></div>

SPAN tag example
<span id=’sampleDiv’ ></span>

Button tag example
<input type=”button” id=’sampleButton’ >

File Upload tag example
<input type=”file” id=’sampleButton’ >

HTML is a easy to complex design marker , HTML can be design smartly to create both beautiful static and interactive application. HTML run only on browser , for example Mozilla , Crome , Brave, Edge etc. The extension HTML file generally HTML , but for Java it is .jsp for ASP. Net it is .aspx , for classic ASP it is .asp , for PHP the extension is .php.

HTML design only by it tag structured , that looks very old style classic looking , to give beautiful professional looking generally CSS is used. CSS stand for Cascading Style Sheet , CSS is created to beautify one or more HTMl tags. CSS have some pre-defined format , to designed the HTML tag , a developer apply CSS on a HTML tag ,then look and feel gets much more attractive and modern.

CSS can be applied into ways, CSS can be written on a tag directly within the style attribute , that is called inline CSS , here is an example of inline CSS.

<div style='color:#408080;border-radius: 13px;padding:10px;'>

Enter fullscreen mode Exit fullscreen mode

But the smarter way is to create a separate class file , the file extension is .CSS and withing the .CSS class file , format is written in pre-define format and the class name is refer to the tag element. Here is an example.

<input type=range class=rangeInput />

<link rel="stylesheet" href="resource/page.css">

Class File Code

.rangeInput
{
-webkit-appearance:none;
appearance:none;
background:transparent;
cursor:pointer;
Width:250px;
Height:7px
}

.rangeInput::-webkit-slider-runnable-track
{
width :250px;
height :7px;
border-radius :10px;
background-color :rgb(107, 222, 219);
} 
.rangeInput::-moz-range-track
{
width :250px;
height :7px;
border-radius :10px;
background-color :rgb(107, 222, 219);
}
.rangeInput::-webkit-slider-thumb
{
-webkit-appearance:none;width :15px;
height :15px;
border-radius: 10px;
background-color: rgb(64, 128, 128);
margin:-5.06px;

}
.rangeInput::-moz-range-thumb
{
width :15px;
height :15px;
border-radius: 10px;
background-color: rgb(64, 128, 128);
margin:-5.06px;

}.rangeInput::-ms-fill-lower
{
width :250px;
height :7px;
border-radius :10px;
background-color :rgb(107, 222, 219);
}
.rangeInput::-ms-fill-upper 
{
width :250px;
height :7px;
border-radius :10px;
background-color :rgb(107, 222, 219);
}
.rangeInput::-ms-thumb 
{
width :15px;
height :15px;
border-radius: 10px;
background-color: rgb(64, 128, 128);
margin:-5.06px;
}
Enter fullscreen mode Exit fullscreen mode

CSS written in a class file work faster than inline CSS , developer prefer external CSS file.

In moderns design CSS is not the final options , current version of CSS is CSS3 , but other designing platform also performing well . SCSS (Sassy CSS) is an advanced stylesheet language that extends CSS

SCSS

  • Variables: Store reusable values like colors, fonts, and spacing.
  • Nesting: Write CSS selectors inside one another to improve readability.
  • Mixins: Create reusable groups of CSS properties.
  • *Inheritance *(@extend): Share styles between multiple selectors.
  • Functions: Perform calculations and manipulate colors or values.
  • Modular Structure: Split styles into multiple files and import them.

Here is an example of SCSS

$primary-color: #3498db;

.card {
  background: $primary-color;
  padding: 20px;

  h2 {
    color: white;
  }

  button {
    background: darken($primary-color, 10%);
    color: white;
  }
}

Enter fullscreen mode Exit fullscreen mode

Why SCSS ?

  • Reduces repetitive CSS code.
  • Improves code organization and maintainability.
  • Makes large projects easier to manage.

Another designing platform is very popular *Tailwind *, utility-first CSS framework that enables developers to build modern and responsive user interfaces. Instead of writing custom CSS for every element, Tailwind provides reusable classes for layout, spacing, colors, typography, borders, shadows, animations, and responsiveness.

Here is an example of Tailwind

<div class="bg-blue-500 p-5 rounded-lg shadow-lg">
    <h2 class="text-white text-2xl font-bold">
        Welcome to Tailwind CSS
    </h2>

    <button class="mt-4 bg-blue-700 text-white px-4 py-2 rounded hover:bg-blue-800">
        Click Here
    </button>
</div>

Enter fullscreen mode Exit fullscreen mode

Why Tailwind ?
Eliminates the need to write large amounts of custom CSS.Produces consistent and reusable designs.Easy to create responsive layouts.

Here is the Comparison
CSS
CSS (Cascading Style Sheets) is the standard stylesheet language used to style and format HTML web pages.

File Extension : .css

Custom CSS Required : Yes

Variables : Supports CSS Custom Properties (--variable).

Nesting: Limited support

Mixins: No

Inheritance : No

Code Reusability : Limited

Development Speed : Handy

Maintenance : difficult for very large projects.

Performance : Satifactory

Responsive Design : require manual media queries

Compilation Required: No

Best Suited For : Small to medium-sized websites and simple web projects.

SCSS

SCSS (Sassy CSS) is an enhanced version of CSS that adds programming features such as variables, nesting, mixins, inheritance, and functions.

File Extension :.scss

Learning Curve: Not so hard

Custom CSS Required : Yes

Variables: Built-in variables , $variable

Nesting : Full support

Mixins: using @mixin

Inheritance: Yes, using @extend

Code Reusability : High

Development Speed : very fast

Maintenance:Easy

Performance:Good , compilation into CSS.

Responsive Design : Supports media queries

Compilation Required :Yes

Best For:Small, medium, and large projects .

Tailwind CSS
Tailwind CSS is a utility-first CSS framework that provides pre-built utility classes for creating responsive and modern user interfaces.

File Extension: No file extension

Learning Curve: Moderate

Custom CSS Required: Very little

Variables : Configurable through the Tailwind configuration file.

Nesting: No

Mixins: No

Inheritance : No

Code Reusability:Very High

Development Speed: Very Fast

Maintenance : Very easy

Performance: Excellent , CSS that are not used will removed during production builds, resulting in smaller CSS files.

Responsive Design : Yes, In-Built
md:, lg:, xl:, and 2xl:.

Compilation Required:Yes

Best For : Quick UI development, responsive websites.

Thus , as the time pass different approach of designing is emerging , every approach has its own advantage and disadvantage and every approach has his own target device and audience .It is very difficult for developer to be master on each platform , very rare developer can handed both CSS ,SCSS and Tailwind simultaneously. But the customer want that his project will be developed by Tailwind or SCSS , to overcome the problem several tools have developed that create designing code automatically , developer only drag and drop control and design HTML tag , such tool is smart enough, it can create Cascading Styles Sheet , SCSS (Sassy CSS) and Tallwind simultaneously. One of such kind of tool is CSS Button Generator , this tool general designing code for button with a live preview. Here is an example of how this button designing tool works.


The HTML

<button type='button' class='SonjuktaCSS' >Click Me</button>

Enter fullscreen mode Exit fullscreen mode


The CSS

<style>
.SonjuktaCSS 
{ 
width :142px;
height :41px;
display :flex;
justify-content :center;
align-items :center;
border-radius: 50px;
border-color: #FFFFFF;
background-color:#813d9c;
cursor:pointer;
text-align:center;
color:#FFFFFF;
font-size:17px;
font-family:Verdana;
} 
</style>
Enter fullscreen mode Exit fullscreen mode


The SCSS

$btn-width: 142px;
$btn-height: 41px;
$radius: 50px;
$border-width: 0px;
$border-style: solid;
$border-color: #FFFFFF;
$bg-color: #813d9c;
$text-color: #FFFFFF;
$font-size: 17px;
$font-family: Verdana;
$font-weight: normal;
$text-align: center;
$padding: 0px;
$margin: 0px;
$opacity: 1;
$hover-bg: #00ff00;
$hover-color: #ff8080;
$box-shadow: 0px 0px 1px #ff8080;

.SonjuktaCSS {
width: $btn-width;
height: $btn-height;
display: flex;
justify-content: center;
align-items: center;
overflow: visible;
line-height: normal;
box-sizing: border-box;
border-radius: $radius;
border: $border-width $border-style $border-color;
background-color: $bg-color;
color: $text-color;
font-size: $font-size;
font-family: $font-family;
font-weight: $font-weight;
text-align: $text-align;
padding: $padding;
margin: $margin;
opacity: $opacity;
cursor: pointer;
box-shadow: $box-shadow;
transition: all .3s ease;

}

Enter fullscreen mode Exit fullscreen mode

Tailwind

<button type="button" style="cursor:pointer;" class="w-[142px] h-[41px] flex justify-center items-center leading-normal overflow-visible box-border rounded-[50px] bg-[#813d9c] text-[#FFFFFF] text-[17px] text-center font-normal font-[Verdana] shadow-[0px_0px_1px_#ff8080]">Click Me</button>

Enter fullscreen mode Exit fullscreen mode

Another open-source CSS framework that is growing rapidly is Bulma.

  • Lightweight and easy to use.
  • Mobile-first responsive framework.
  • Clean and modern UI components.

Here is the example of Bulma

<div class="box">
    <h2 class="title is-3">Welcome to Bulma</h2>

    <button class="button is-primary">
        Click Me
    </button>
</div>

Enter fullscreen mode Exit fullscreen mode

**Bulma **is a lightweight, Flexbox-based CSS framework that enables developers to build responsive and attractive user interfaces quickly.

Top comments (0)