Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram: [ Ссылка ]
Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!How to define flex-1 as max-width?
I use tailwindcss and vue. Now I create header and I have a problem.
tailwindcss
vue
template
header
class="w-[100vw] max-w-[100vw] box-border bg-white whitespace-nowrap px-7 shadow-lg border-b border-b-gray-300 py-[2px] flex flex-row items-center select-none"
div class="border-2 border-black p-[2px] flex flex-row cursor-pointer mr-3"
// logo
/div
div class="flex flex-row items-center gap-1"
// some routes
/div
div class="flex-1 flex flex-row justify-between items-center gap-2"
TemalarSlider :dynamic-width="dynamicWidth" /
Search @searchToggled="handleSearchToggle" /
/div
div class="select-none flex flex-row gap-2 relative items-center justify-end py-1"
// also some routes
/div
/header
/template
script setup
const dynamicWidth = ref('100%')
function handleSearchToggle(isOpen) {
dynamicWidth.value = isOpen ? 'calc(100% - 300px)' : '100%' // Adjust as needed
}
/script
template
header
class="w-[100vw] max-w-[100vw] box-border bg-white whitespace-nowrap px-7 shadow-lg border-b border-b-gray-300 py-[2px] flex flex-row items-center select-none"
div class="border-2 border-black p-[2px] flex flex-row cursor-pointer mr-3"
// logo
/div
div class="flex flex-row items-center gap-1"
// some routes
/div
div class="flex-1 flex flex-row justify-between items-center gap-2"
TemalarSlider :dynamic-width="dynamicWidth" /
Search @searchToggled="handleSearchToggle" /
/div
div class="select-none flex flex-row gap-2 relative items-center justify-end py-1"
// also some routes
/div
/header
/template
script setup
const dynamicWidth = ref('100%')
function handleSearchToggle(isOpen) {
dynamicWidth.value = isOpen ? 'calc(100% - 300px)' : '100%' // Adjust as needed
}
/script
Here I want flex-1 must be max-width. here Search this animated search bar.
Search
My TemalarSlider this:
TemalarSlider
template
div
:style="{ maxWidth: dynamicWidth, width: dynamicWidth }"
class="overflow-hidden bg-gray-400 transition-all duration-500"
AnOutlinedArrowLeft /
div class="overflow-x-auto flex flex-row items-center pr-4"
// more items
/div
AnOutlinedArrowRight /
/div
/template
script setup
import useOthers from '@/stores/others'
import { AnOutlinedArrowLeft, AnOutlinedArrowRight } from '@kalimahapps/vue-icons'
const others = useOthers()
defineProps(['dynamicWidth'])
/script
style scoped /style
template
div
:style="{ maxWidth: dynamicWidth, width: dynamicWidth }"
class="overflow-hidden bg-gray-400 transition-all duration-500"
AnOutlinedArrowLeft /
div class="overflow-x-auto flex flex-row items-center pr-4"
// more items
/div
AnOutlinedArrowRight /
/div
/template
script setup
import useOthers from '@/stores/others'
import { AnOutlinedArrowLeft, AnOutlinedArrowRight } from '@kalimahapps/vue-icons'
const others = useOthers()
defineProps(['dynamicWidth'])
/script
style scoped /style
When I dont add items work well. after i add item width TemalarSlider increased. How to do this? I try do this overflow-x-scroll. But dont be.
Tags: css,tailwind-cssSource of the question:
[ Ссылка ]
Question and source license information:
[ Ссылка ]
[ Ссылка ]
Ещё видео!