How can I make corners and squares be borders?


UserTest013

How can I make corners and squares be borders? And break one of the borders. Like on the image.

enter image description here

I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border.

:root {
  --size: 8px;
  --r: -3px;
}

.wrapper {
  position: relative;
  border: 1px solid black;
  margin: 25px auto;
  padding: 2px;
  width: max-content;
}

.inner {
  padding: 15px 25px;
  border: 1px solid black;
}

.conner {
  position: absolute;
  height: var(--size);
  width: var(--size);
  background-color: black;
}

.bottom {
  bottom: var(--r);
}

.right {
  right: var(--r);
}

.top {
  top: var(--r);
}

.left {
  left: var(--r);
}
<div class="wrapper">
  <div class="inner">qwerty</div>
  <div class="conner top left"></div>
  <div class="conner top right"></div>
  <div class="conner bottom left"></div>
  <div class="conner bottom right"></div>
</div>

Ismail Vittal

You can use properties border-imagein CSS .

In these order:

  1. Create an image like this:

border image

  1. Applies border-imageto .wrapperand provides the URL of the image. Learn more about border images : https://developer.mozilla.org/en-US/docs/Web/CSS/border-image

.wrapper {
  height: 160px;
  width: 250px;
  border-style: solid; 
  border-image: url(https://i.stack.imgur.com/2RoPg.png) 12 / 6 stretch;
  position: relative;
  box-sizing: border-box;
}

.inner {
  height: 100%;
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;  
}
<div class="wrapper">
  <div class="inner">QWERTY</div>
</div>

Related


How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make corners and squares be borders?

UserTest013 How can I make corners and squares be borders? And break one of the borders. Like on the image. I did it with another four blocks, but I thought there might be a better way. And I don't know how to break the outer border. :root { --size: 8px; -

How can I make the corners of the button rounded?

artist I want to make buttonrounded corners. Is there an easy way to achieve this in Android? Dr. Monsur Hussein Tomo if you want something like this Here is the code. 1. Create an xml file in your drawable folder (like mybutton.xml) and paste the following ma

How can I make my corners round?

William In this design, I have rounded corners in CSS, but only the top two corners are not. How can I make them round as well? .pricing-page li { width: 32%; float: left; text-align: center; display: inline-block; box-shadow: 1px 1px 22px rgba(157,

How can I make the corners of the button rounded?

artist I want to make buttonrounded corners. Is there an easy way to achieve this in Android? Dr. Monsur Hussein Tomo if you want something like this Here is the code. 1. Create an xml file in your drawable folder (like mybutton.xml) and paste the following ma

How can I make the corners of the button rounded?

artist I want to make buttonrounded corners. Is there an easy way to achieve this in Android? Dr. Monsur Hussein Tomo if you want something like this Here is the code. 1. Create an xml file in your drawable folder (like mybutton.xml) and paste the following ma

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the borders of the rectangles different?

Genji HTML: <div class="rectangle">Some text</div> CSS: .rectangle { width: 300px; height: 80px; border: 5px solid red; } Is there a way to make the div look like it does in the photo? hash Check CSS shapes #pointer { width: 200px; height: 40

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the borders overlap?

Daniel Chu I'm trying to have the header's border top have one color, and when the nav is hovered/activated, part of it changes to another color. and why is my li:hovertab border-topstill returning me border-bottom? What I'm trying to achieve in the picture As

How can I make the corners of the bottom sheet dialog rounded?

Spencer Beaumont: I'm trying to make the top corner of the BottomSheetDialog round, but I have no luck on the line. This is what I want it to look like: No matter what I try, I get the following: I've tried the approach here and used shapeAppearanceLargeCompon

How can I make the corners of the bottom sheet dialog rounded?

Spencer Beaumont: I'm trying to make the top corner of the BottomSheetDialog round, but I have no luck on the line. This is what I want it to look like: No matter what I try, I get the following: I've tried the approach here and used shapeAppearanceLargeCompon

How can I make the image have rounded corners too?

Facebook Facebook logo Sign up for Facebook to connect with Adnan Cejvan I've been trying to make the corners of the image also rounded, but when I apply border-radiuson the div , the corners of the image don't change at all. #bredband { height: 330px; wid

How can I make the corners of the bottom sheet dialog rounded?

Spencer Beaumont: I'm trying to make the top corner of the BottomSheetDialog round, but I have no luck on the line. This is what I want it to look like: No matter what I try, I get the following: I've tried the approach here and used shapeAppearanceLargeCompon