css - Why do you put a display:block on an "a" tag that is inside a list? -
i trying understand image sprites on css, , 1 line of code looks this.
#navlist li, #navlist a{height:44px;display:block;}
i wondering effect display:block has on "a", know "a" tag since link won't work if removed "a" , conversely if removed "display:block", i'm wondering why should "display:block".
the w3schools explanation display:block
fallow
the element displayed block-level element (like paragraphs , headers)
, can check display behavior here
practically use display:block
in 4 situations
- element doesn't contains content, need show fix size block. eg: link background image no text between open , close anchor tags.
- element need show in fix size ignore auto size according content.
- there set of elements , each should display in each line (one element per line).
- to implement show hide can use
diaply:none
,display:block
but link functionality doesn't have relationship display
or css
, link showld work interdependently, css wrote anchor tag, style link.
here more details display
https://developer.mozilla.org/en-us/docs/web/css/display
Comments
Post a Comment