Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have a transparent border?

Tags:

html

css

I have this code for my border:

border: 1px solid #CCC;

Is it possible to have some similar CSS where the border has a width but it's not visible. In other words if there's a blue background then that would show right through the border?

like image 236
Samantha J T Star Avatar asked Dec 03 '22 14:12

Samantha J T Star


1 Answers

A margin occupies space and is transparent. The space a margin occupies is on the outside of the element, so it takes the background color of the parent element. If you want it to be space with the same background color as the element you are modifying, you would want to use padding.

This is a great resource that shows you what you will probably want: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model

like image 184
Taylor Avatar answered Feb 27 '23 04:02

Taylor