Does CSS affects HTML semantics? -


does css affects html semantics?

for example, hiding bullets of ordered list (<ol><li>) , using image instead. treated unordered list after applying css?

no, css not affect html semantics. there may have been historic semantic differences between <ul> , <ol> besides default numbering each type of list item (some claim <ul> supposed represent unordered set while <ol> supposed represent ordered list), in practice real difference between 2 default numbering without custom style formatting.

the order of items still relevant both tags represents order browser display items in. browser not free show <ul> items in random order.

if you've customized numbering yourself, there no actual display difference between two. if search engine looking through page, going see actual html tags put in page , it's not going change it's behavior if use bullet instead of number via css setting.


some argue there semantic difference between 2 tags (set vs. list) , html5 specification refers semantic difference, hard pressed know of situation semantic difference relevant or used. in case point of question, whatever semantic difference there not change because css styling changed list display custom images instead of numbers or vice versa.

the html5 specification has say:

the ul element represents list of items, order of items not important — is, changing order not materially change meaning of document.

and this:

the ol element represents list of items, items have been intentionally ordered, such changing order change meaning of document.

there nothing in specification says if changing visible formatting of numbering css, html semantics change.


Comments