Ask Your Question
3

What is the method for causing two borders to overlap?

asked 2022-10-18 11:00:00 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-08-11 19:00:00 +0000

scrum gravatar image

The method for causing two borders to overlap is to apply a negative margin to one of the elements. This will cause the element to overlap with the adjacent element, including its border. Here is an example:

HTML:

<div class="box1"></div>
<div class="box2"></div>

CSS:

.box1 {
  width: 100px;
  height: 100px;
  background-color: red;
  border: 10px solid blue;
}
.box2 {
  width: 100px;
  height: 100px;
  background-color: blue;
  border: 10px solid red;
  margin-left: -10px;
}

In this example, we have two div elements with different background colors and border colors. By applying a negative margin of 10px to the second box, it overlaps with the first box, causing their borders to overlap.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-10-18 11:00:00 +0000

Seen: 18 times

Last updated: Aug 11 '21