Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.08k stars 4.95k forks source link

[Header] "text alignement" should display accordingly when there is an icon as content #6902

Open challet opened 4 years ago

challet commented 4 years ago

Steps

Expected Result

The header content is aligned accordingly.

Actual Result

The header content stays left aligned.

Version

2.4.2

Testcase

https://jsfiddle.net/w236rdmz/

VanquishedWombat commented 4 years ago

Maybe not an answer but the HTML spec informs us that H2 is meant to contain only 'phrasing content' and not structural stuff like div's. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements. Since SUI is building on HTML it is usually worth following HTML principles as a foundation and SUI then applies pleasing CSS.

Re-writing your code, removing the div inside the H2 seems to work, though vertical alignment may need attention.

has a div.content

challet commented 4 years ago

That's right, so seeing it the other way around and replacing the divs by spans, wich belongs to phrasing content, the problem remains : https://jsfiddle.net/cp6Lfj3m/. I think it's more about the .content class than the type of element, though your comment is indeed right from a semantic (not the ui one) point of view.

Also added a case with only <div>s as I thought it was in the documentation example, but it happens that the "icon" one is using <h2> as well. The one about "text alignment" has indeed no div inside. It confuses me, but imho variations should be compatible with all kind of types and contents referenced.