html - how to make a css border for div -
i used link how set border html div tag make css border div tag.
<!doctype html> <html> <head> <style type="text/css"> #box{ border: 5px solid black; } </style> </head> <body> <div id="box"> sign in </div> </body> </html> if put border: 10px; or border-right: 5px solid black; then, there no border. why happen ?
border: 10px; not work because border requires @ least style because there no default style, default color black don't need color. following work
#box { border: 10px solid; } border-right: 5px solid black; same border-right: 5px solid; , display, div block element , such takes entire width of container (just @ right side of page)
now if want border directly beside text can turn block element div inline-block element
#box { display: inline-block; border-right: 5px solid black; } also can set each border property individually so
#box { border-width: 5px; border-style: solid; border-color: black; } or 1 side so
#box { border-right-width: 5px; border-right-style: solid; border-right-color: black; }
Comments
Post a Comment