Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlapping 1 px Borders making a thicker border

Is there a way, when I have over lapping (touching) div's, to make the 1px border not become 2 pixels. And I know I could just put a border on 2 of the sides, but then the one edge of the div wouldn't have a border. By the way, I'm using jQuery Masonry.

like image 882
Sam Clark Avatar asked Aug 27 '12 00:08

Sam Clark


People also ask

How do I make a border less than a pixel?

You can’t make it less than a pixel. It doesn’t work like that. A pixel is the smallest physical beaming point on a display. You can try to use low colour contrast between the border colour and the background colour to make it feel thinner. So basically if you have a white background then use a light grey tone such as #ddd for the border.

How many border-style values can the border-color property have?

The effect depends on the border-color value The border-style property can have from one to four values (for the top border, right border, bottom border, and the left border). A dotted border.

How to set the width of a border?

The border-width property specifies the width of the four borders. The width can be set as a specific size (in px, pt, cm, em, etc) or by using one of the three pre-defined values: thin, medium, or thick:

How do you make a border look thinner?

A pixel is the smallest physical beaming point on a display. You can try to use low colour contrast between the border colour and the background colour to make it feel thinner. So basically if you have a white background then use a light grey tone such as #ddd for the border. How do you make a CSS element not clickable?


2 Answers

yes the div on the right would look something like this

     border: 1px solid #fff;
     border-left: none;

the second border-left will override the left border that was just put on there

EDIT:

ok, since youre using jQuery masonary - do it like this

            .container {
              width:50px;
              height:80px;
              border:1px solid black;
              margin-right: -1px;
              margin-bottom: -1px;
              }

the overlapping method I mentioned will work

like image 121
Scott Selby Avatar answered Sep 18 '22 17:09

Scott Selby


Combining borders and margins (even with border-box) is tricky because your layout depends on the container width. It is better to add a child to the element positioned by Masonry and style that...

.container .post {
   float: left;
   width: 240px;
}

.container .text {
    outline: 1px solid #999;
    padding: 10px;
    margin: 0 1px 1px 0;
}

outline allows the border to appear "outside" the div which makes them easier to overlap

http://jsfiddle.net/4xmUY/

(if you happen to use this answer please accept Scott's answer as this should be a comment on his answer but the explanation doesn't fit there).

like image 21
methodofaction Avatar answered Sep 19 '22 17:09

methodofaction