-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fixed incorrect aspect ratio issue with object-fit #191
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -103,11 +103,13 @@ class Step extends BaseStepElement { | |||
width: auto; | ||||
height: 40px; | ||||
margin: 20px 0; | ||||
object-fit: contain; | ||||
|
||||
@media only screen and (min-width: 768px) { | ||||
width: 60px; | ||||
height: 60px; | ||||
margin: 50px 0; | ||||
object-fit: contain; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 위에 적용한 스타일이 아래에 그대로 적용되어서 여기는 작성할 필요 없을 것 같습니다
Suggested change
|
||||
} | ||||
} | ||||
.step-content { | ||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희 전반적인 구현을 보시면 이미지의 높이가 이미지의 본래 가로 세로 비율에 맞춰서 자동으로 결정이 되도록
height
속성을 특정값으로 설정하는 경우는 없는 것 같습니다. 그런데 좀 특이하게도 아래 코드를 보시면,<ds-image>
요소에 일일이height
속성을auto
로 설정해놓은 것을 볼 수 있습니다. 저는 혹시 Lighgthouse 엔진이 이 부분을 고려하지 않고 경고를 주지 않았나 의심이 됩니다. 한번 아래 코드에서height="auto"
만 제거해보시고 Lighthouse를 돌려보시면 어떨까요?제가 알기로
object-fit
속성은<img>
요소의width
와height
속성을 둘 다 특정값으로 명시해줬을 때 어떤 효력을 발휘하거든요. 불필요한 CSS rule은 언제나 유지보수를 힘들게 하는 것 같아요. 혹시나 통할까 하여 제안드려 봅니다 :)leetcode-website/index.html
Lines 72 to 92 in 52d5df5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀하신대로
height="auto"
와object-fit
을 제거하고 테스트 해보았는데 incorrect aspect ratio 이슈가 다시 생겨났습니다.눈으로 보기에 ratio 문제가 없더라도 displayed ratio와 actual ratio 차이가 크고 해당 이미지가 상위 컨테이너를 벗어날 위험이 있다고 판단되면 라이트하우스가 이슈를 만들어내는 것 같습니다. ㅜ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아이쿠 안 통하는 군요. 시간내서 시도해주셔서 감사합니다. 네 그럼 요렇게 조치 하시죠!