Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nowrap 容器 下的 inline-block 子元素 #9

Open
fisker opened this issue Nov 14, 2017 · 0 comments
Open

nowrap 容器 下的 inline-block 子元素 #9

fisker opened this issue Nov 14, 2017 · 0 comments

Comments

@fisker
Copy link
Owner

fisker commented Nov 14, 2017

inline-block 子元素 在 nowrap 容器下的宽度 可能和预期的不太一样

demo: https://jsfiddle.net/fisker/r96jnwda/

stackoverflow 上也有类似的提问

https://stackoverflow.com/questions/22126789/an-inline-block-div-with-white-space-normal-exceeds-the-width-of-a-parent-wit

解决方案很多,可以自己尝试。

利用这点,倒是可以做一个布局的尝试

适用于一部分内容宽度固定 另一部分占据剩余空间的布局

好处是非常简单就可以垂直居中。

demo: https://jsfiddle.net/fisker/j10rv6o2/2/

@fisker fisker changed the title nowrap 容器 下的 inline-block 子元素 nowrap 容器 下的 inline-block 子元素 Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant