Full-Width Section Inside a Fixed-Width Container | CSS Tips

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024

ความคิดเห็น • 15

  • @biggand8520
    @biggand8520 3 หลายเดือนก่อน +4

    Hey, grid solution is cool and light enough. I think everyone faced with the issue like this, so your content is relevant. If you need just a background to be spread across the entire screen, then you can do also box-shadow(0 0 0 100vmax your_color) and clip-path(0 -100vmax) to prevent horizonal scroll. But this works only for background, its useless for the content, thus your solution rules.

    • @OptimisticWeb
      @OptimisticWeb  3 หลายเดือนก่อน +1

      Thanks for sharing another trick! It's always great to discover new approaches.

  • @mikeeomega
    @mikeeomega 3 หลายเดือนก่อน +2

    I wish you made videos when I was learning. Great content.

    • @OptimisticWeb
      @OptimisticWeb  3 หลายเดือนก่อน +2

      Thank you! I wish I had a time machine to go back and help out-I could have been learning along with you! 😊 But seriously, I'm glad you're here now and enjoying the content.

    • @niazhimselfangels
      @niazhimselfangels 3 หลายเดือนก่อน +1

      Aren't you still? :)

    • @OptimisticWeb
      @OptimisticWeb  3 หลายเดือนก่อน

      yeah, I'm still learning. It never ends...

  • @hansdampf10
    @hansdampf10 3 หลายเดือนก่อน +1

    Great content, you should make a course.

    • @OptimisticWeb
      @OptimisticWeb  3 หลายเดือนก่อน

      Thanks so much! I appreciate the suggestion. Making a course does require a lot of time and resources, but it's definitely something to consider for the future. Glad you're enjoying the content!

  • @viveknayak
    @viveknayak 3 หลายเดือนก่อน +1

    Nice video. Would it be possible for you to do a 2 column layout (Image left and text on the right) with the image on the left bleeding outside the container?

    • @OptimisticWeb
      @OptimisticWeb  3 หลายเดือนก่อน +2

      Thank you! Using a CSS grid would make that easier. You could set up two columns in the middle, like "1fr 40% 40% 1fr". The image could then span lines 1 to 3, with the text from lines 3 to 5. The remaining content would start at line 2 and end at line 4.

    • @viveknayak
      @viveknayak 3 หลายเดือนก่อน +1

      @@OptimisticWeb Thanks.

  • @sajaddjf9384
    @sajaddjf9384 4 วันที่ผ่านมา +1

    Can we use code
    minmax(3rem, 1fr) minmax(auto, 65ch) minmax(3rem, 1fr)
    as a replacement for code
    grid-template-columns: 1fr min(calc(100% - 3rem * 2), 65ch) 1fr
    ?

    • @OptimisticWeb
      @OptimisticWeb  3 วันที่ผ่านมา

      Yes, that should work, and in that case, you won't need to add any gap.

  • @michaelxaviercanonizado7931
    @michaelxaviercanonizado7931 2 หลายเดือนก่อน +1

    Solution #2 somehow doesn't work for me. When either margin left or right is applied, it works. But when combined, it doesn't stretch

    • @OptimisticWeb
      @OptimisticWeb  2 หลายเดือนก่อน

      You can either compare your code with the demo link in the description or share your version with me. I may be able to debug and help.