अभी तक आपने के बारे में border-width , border-style , border-color के बारे में पढ़ा और समझा , इन properties का use करके आप किसी भी HTML Element के लिए border define करते थे। लेकिन इनके अलावा एक shorthand border property भी होती है , जिसकी help से आप एक ही बार में border width , style , color define कर सकते हैं।

element{
  border : width style color;
}

CSS border example

border: 10px outset red;

border: 15px inset goldenrod;

border: 5px dashed green;

CopyFullscreenClose FullscreenRun
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>CSS border shorthand Example</title>
  </head>
  <body>
    <h1 style="border: 10px outset red;">border shorthand Example</h1>
    <h1 style="border: 15px inset goldenrod;">border shorthand Example</h1>
    <p style="border: 5px dashed green;">border shorthand Example</p>
  </body>
</html>

CSS define border for every side

हालांकि आप border की हर एक side को अलग अलग भी define कर सकते हैं।

CSS border-top

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>CSS border-top Example</title>
  </head>
  <body>
    <p style="border-top:8px solid goldenrod;">border-top Example</p>
  </body>
</html>
Output

border-top Example

CSS border-bottom

<!DOCTYPE html>
  <html>
    <head>
      <meta charset="utf-8">
      <title>CSS border-bottom Example</title>
    </head>
    <body>
      <p style="border-bottom:8px solid green;">border-bottom Example</p>
    </body>
  </html>
Output

border-bottom Example

CSS border-left

<!DOCTYPE html>
  <html>
    <head>
      <meta charset="utf-8">
      <title>CSS border-left Example</title>
    </head>
    <body>
      <p style="border-left:8px solid red;">border-left Example</p>
    </body>
  </html>
Output

border-left Example

CSS border-radius

आप border-radius property का use करके border को rounded भी बना सकते हैं।

p{
  border:8px inset green;
  border-radius: 5px;
}

Output : 

border-radius: 5px;


और आप चाहे तो border की हर side को अलग तरह से भी round कर सकते हैं।

border-radius: 20px 15px 10px 5px;

border-radius: 5px 10px 15px 20px;

border-radius: 15px 3px 3px;

CSS border-radius example

CopyFullscreenClose FullscreenRun
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>CSS border-radius Example</title>
  </head>
  <body>
    <p style="border:8px inset green;border-radius: 20px 15px 10px 5px;">border-radius: 20px 15px 10px 5px;</p>
    <p style="border:8px inset gold;border-radius: 5px 10px 15px 20px;">border-radius: 5px 10px 15px 20px;</p>
    <p style="border:8px inset red;border-radius: 15px 3px 3px">border-radius: 15px 3px 3px;</p>
  </body>
</html>

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers