Author: saqibkhan

  • Rounded Corners

    CSS rounded corners are created using the border-radius property. This property allows you to specify the radius of the corners of an element’s outer border edge.

    Possible Values

    • <length>: Size of circle radius is denoted, using length values. Negative values are not valid.
    • <percentage>: Size of circle radius is denoted, using percentage values.
      • Horizontal axis percentage is referred to the width of the box.
      • Vertical axis percentage is referred to the height of the box.
      • Negative values are not valid.

    Applies to

    All the HTML elements, except for table and inline-table elements with border-collapse set to collapse. Applies to ::first-letter.

    DOM Syntax

    object.style.borderRadius = "length";
    

    The following diagram demonstrates the different border-radius corners for reference:

    border-radius

    The following table shows the possible values for rounded corners as follows −

    ValueDescription
    radiusAll CornerIs a <length> or a <percentage> that sets the radius for all four corners of the element. It is used only in the one-value syntax.
    top-left and bottom-rightTop Left Bottom RightIs a <length> or a <percentage> that sets the radius for the top-left and bottom-right corners of the element. It is used only in the two-value syntax.
    top-right and bottom-leftTop Right Bottom LeftIs a <length> or a <percentage> that sets the radius for the top-right and bottom-left corners of the element. It is used only in the two- and three-value syntaxes.
    top-leftTop LeftIs a <length> or a <percentage> that sets the radius for the top-left corner of the element. It is used on three and four value syntaxes.
    top-rightTop RightIs a <length> or a <percentage> that sets the radius for the top-right corners of the element. It is used only in the four-value syntax.
    bottom-rightBottom RightIs a <length> or a <percentage> that sets the radius for the bottom-right corners of the element. It is used only in the three and four-value syntaxes.
    bottom-leftBottom LeftIs a <length> or a <percentage> that sets the radius for the bottom-left corners of the element. It is used only in the four-value syntax.

    Individual border radius properties, such as border-top-left-radius, cannot inherit from their parent element. Instead, you must use the individual longhand properties to set the border radius of each corner.

    CSS Border Radius – Length Value

    The following example demostrates how to use the border-radius property to create rounded corners for all four corners of a box −

    Open Compiler

    <html><head><style>
       .rounded-box {
    
      width: 200px;
      height: 100px;
      background-color: pink;
      line-height: 100px;
      border-radius: 20px;
    } </style></head><body><div class="rounded-box">
      This is a rounded corner box.
    </div></body></html>

    You can use the border-radius property to create rounded corners on box, borders, and images.

    Here is an example −

    Open Compiler

    <html><head><style>
       .rounded-box {
    
      width: 200px;
      height: 100px;
      background-color: pink;
      border-radius: 20px;
      margin-bottom: 10px;
    } .border-box {
      width: 200px;
      height: 100px;
      border-radius: 2em;
      border: 3px solid green; 
      margin-bottom: 20px;   
    } .img-border-radius {
      background-image: url(images/tree.jpg);
      background-size: 100% 100%;
      border-radius: 20%;
      width: 200px;
      height: 150px;
    } </style></head><body><div class="rounded-box">
      This is a rounded corner box.
    </div><div class="border-box">
      This is a rounded corner box.
    </div><div class="img-border-radius">
      This is a rounded corner image.
    </div></body></html>

    You can use the border-radius property to create different rounded corner styles on an element.

    Here is an example −

    Open Compiler

    <html><head><style>
       .rounded-box {
    
      width: 200px;
      height: 100px;
      background-color: pink;
      margin: 10px;
      padding: 5px;
    } .rounded-box.tl {
      border-radius: 30px 0 0 0;
    } .rounded-bo x.tr {
      border-radius: 0 2em 0 0;
    } .rounded-box.bl {
      border-radius: 0 0 0 15%;
    } .rounded-box.br {
      border-radius: 0 0 30px 0;
    } .rounded-box.tl-br {
      border-radius:  2em 0 2em 0;
    } .rounded-box.tr-bl {
      border-radius: 0 15% 0 15%;
    } </style></head><body><div class="rounded-box tl">
      top-left rounded corner.
    </div><div class="rounded-box tr">
      top-right rounded corner.
    </div><div class="rounded-box bl">
      bottom-left rounded corner.
    </div><div class="rounded-box br">
      bottom-right rounded corner.
    </div><div class="rounded-box tl-br">
      top-left and bottom-right rounded corners.
    </div><div class="rounded-box tr-bl">
      top-right and bottom-left rounded corners.
    </div></body></html>

    CSS Rounded Corner Images

    You can use the border-radius property to create different rounded corner styles on elements.

    Here is an example −

    Open Compiler

    <html><head><style>
       img {
    
      width: 200px;
      height: 100px;
      margin: 10px;
    } .top-left {
      border-radius: 30px 0 0 0;
    } .top-right {
      border-radius: 0 2em 0 0;
    } .bottom-left {
      border-radius: 0 0 0 15%;
    } .bottom-right {
      border-radius: 0 0 30px 0;
    } .tl-br {
      border-radius:  2em 0 2em 0;
    } .tr-bl {
      border-radius: 0 15% 0 15%;
    } </style></head><body><h4>top-left rounded corner.</h4><img class="top-left" src="images/tree.jpg" /><h4>top-right rounded corner.</h4><img class="top-right" src="images/tree.jpg" /><h4> bottom-left rounded corner.</h4><img class="bottom-left" src="images/tree.jpg" /><h4>bottom-right rounded corner.</h4><img class="bottom-right" src="images/tree.jpg" /><h4>top-left and bottom-right rounded corners.</h4><img class="tl-br" src="images/tree.jpg" /><h4>top-right and bottom-left rounded corners.</h4><img class="tr-bl" src="images/tree.jpg" /></body></html>

    We can create a circle and an ellipse using the CSS border-radius property.

    Here is an example −

    Open Compiler

    <html><head><style>
       .rounded-circle {
    
      width: 100px;
      height: 100px;
      background-color: pink;
      text-align: center;
      border-radius: 50%;
    } .rounded-ellipse {
      width: 200px;
      height: 100px;
      background-color: pink;
      text-align: center;
      border-radius: 50%;
    } </style></head><body><div class="rounded-circle">
      circle
    </div><div class="rounded-ellipse">
      ellipse
    </div></body></html>

    CSS border-radius – Related Properties

    Following is the list of CSS properties related to border-radius:

    propertyvalue
    border-top-left-radiusSets the roundness of the top-left corner of an element’s border.
    border-top-right-radiusSets the roundness of the top-right corner of an element’s border.
    border-bottom-right-radiusSets the roundness of the bottom-right corner of an element’s border.
    border-bottom-left-radiusSets the roundness of the bottom-left corner of an element’s border.
    border-start-start-radiusSets the roundness of the block-start and inline-start corner of an element’s border.
    border-start-end-radiusSets the roundness of the block-start and inline-end corner of an element’s border.
    border-end-start-radiusSets the roundness of the block-end and inline-start corner of an element’s border.
    border-end-end-radiusSets the roundness of the block-end and inline-end corner of an element’s border.
  • Open Source and Community-Driven

    jQuery has always been free and open source. It is maintained by the jQuery Foundation and supported by a large community of developers around the world. This openness helped it spread quickly, since anyone could use it, contribute to it, or build plugins on top of it.

  • jQuery UI Extended Its Power

    To make things even easier, the jQuery team released jQuery UI, a companion library that offered ready-to-use widgets and effects. Developers could instantly add sliders, datepickers, tabs, tooltips, and drag-and-drop functionality without writing heavy code.

  • An Inspiration for Modern Frameworks

    jQuery’s simplicity influenced the design of modern frameworks. Concepts like chaining methods, selecting elements easily, and simplifying DOM manipulation inspired developers of tools such as React, Angular, and Vue. In a way, jQuery paved the path for the frameworks we use today.

  • Still Used on Millions of Websites

    Even though modern frameworks like React and Vue dominate today, jQuery hasn’t disappeared. Because of WordPress, Joomla, Drupal, and countless older projects, around 70–80% of websites still load jQuery in some form. It’s a reminder of how deeply the library shaped the web.

  • A Massive Plugin Ecosystem

    jQuery wasn’t just a library—it was the center of a huge ecosystem. Thousands of plugins were created for it, covering everything from image sliders and modal popups to form validation and interactive charts. This plugin library allowed developers to add complex features without starting from scratch.

  • The Cross-Browser Savior

    Back in the mid-2000s, every browser had its own quirks. A script that worked in Internet Explorer might break in Firefox or Safari. jQuery became famous for solving this problem. Developers could finally write one set of code that behaved consistently across all major browsers.

  • Small but Powerful

    Despite its impact, the minified version of jQuery is just about 90 KB. That’s tiny compared to modern frameworks. Yet, this small file simplified tasks that used to require dozens of lines of vanilla JavaScript, saving developers time and effort.

  • WordPress Includes jQuery by Default

    One of the biggest reasons for jQuery’s dominance is its inclusion in WordPress. Since WordPress powers millions of websites worldwide, jQuery automatically became part of them. Even today, a huge percentage of websites load jQuery only because of this integration.

  • The Most Popular Library of Its Time

    By 2015, jQuery had become a web development standard. Studies showed that more than 70% of the top 1 million websites were powered by jQuery. From small blogs to massive corporate websites, everyone relied on it to handle interactivity and cross-browser issues.