+ 2

What is difference between( outline and border )?

In language program CSS for example for use : outline: 10px solid green; border: 10px solid green; same code But what is difference?

18th Mar 2018, 1:10 AM
Sarmad Saad
Sarmad Saad - avatar
4 Réponses
+ 2
Outlines can be offset, don’t have a radius property to round the corners, and you can’t style only one side. They do not affect the object’s position or the space it takes up in the page. Borders can’t be offset, have a radius property to round the corners, and you can style the sides separately. Borders are part of the DOM model, so they do make the object bigger in the page. I usually see the outline as a debugging tool and the border as a style tool
18th Mar 2018, 1:27 AM
Ariela
Ariela - avatar
+ 2
border is intended for styling purpose, outline is primarly intended for visually shown focused elements (related to tabindex to let user switch between form elements with tab key )... https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
18th Mar 2018, 6:00 AM
visph
visph - avatar
+ 1
Thanks @Just
18th Mar 2018, 1:31 AM
Sarmad Saad
Sarmad Saad - avatar
0
237 anx3.
12th May 2018, 9:13 AM
mr heaven
mr heaven - avatar