Tailwind CSS center horizontally in navbar - html

Using the default tailwindcss navbar in Laravel Breeze, I want to center the application logo, whilst having navigation links on the far left and right of it. There will be three navigation links on one side, and just two on the other, so flex-between won't work properly. Any ideas how to do it? Here is the entire default navbar, and how it currently looks.
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100 py-6">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('index') }}">
<x-application-logo class="block h-10 w-auto fill-current text-gray-600" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<x-nav-link :href="route('index')" :active="request()->routeIs('index')">
{{ __('Home') }}
</x-nav-link>
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Occupational Health') }}
</x-nav-link>
<x-nav-link :href="route('bookings')" :active="request()->routeIs('bookings')">
{{ __('Inquiry') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ml-6">
#guest
#if (Route::has('login'))
#endif
#else
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
<div>{{ Auth::user()->name }}</div>
<div class="ml-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
#csrf
<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
#endguest
</div>
<!-- Hamburger -->
<div class="-mr-2 flex items-center sm:hidden">
<button #click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
#guest
#if (Route::has('login'))
#endif
#else
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('index')" :active="request()->routeIs('index')">
{{ __('Home') }}
</x-responsive-nav-link>
<x-responsive-nav-link :href="route('bookings')" :active="request()->routeIs('bookings')">
{{ __('Bookings') }}
</x-responsive-nav-link>
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
#csrf
<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
#endguest
</div>
</nav>

Thank you to Martin for helping me solve this!
Each section of the navbar was split into containers of width 1/3, and the logo centered in its container, similar to this:
<div class="flex">
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex sm:w-1/3">
<x-nav-link :href="route('index')" active="request()->routeIs('index')">
{{ __('Home') }}
</x-nav-link>
<x-nav-link class="text-center" :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Occupational Health') }}
</x-nav-link>
<x-nav-link :href="route('bookings')" :active="request()->routeIs('bookings')">
{{ __('Inquiry') }}
</x-nav-link>
</div>
</div>
<div class="flex w-1/3 justify-center">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('index') }}">
<x-application-logo class="block h-10 w-auto fill-current text-gray-600" />
</a>
</div>
</div>
<div class="hidden sm:flex w-1/3 justify-end">
<x-nav-link :href="route('bookings')" :active="request()->routeIs('bookings')">
{{ __('Inquiry') }}
</x-nav-link>
</div>

Related

How to set an item at the bottom of a card components in TailwindCss

I want the footer tag in this card to be always at the bottom of the card Regardless the length of the paragraph and the title above it.
I'm using tailwindCss and Laravel.
here is the component of the card
#props(['post'])
<article
{{ $attributes -> merge(['class' => 'transition-colors duration-300 hover:bg-gray-100 border border-black border-opacity-0 hover:border-opacity-5 rounded-xl']) }}>
<div class="py-6 px-5">
<div>
{{-- TODO --}}
<img src="./images/illustration-3.png" alt="Blog Post illustration" class="rounded-xl">
</div>
<div class="mt-8 flex flex-col justify-between">
<header>
<div class="space-x-2">
<x-category-button :category="$post->category" />
</div>
<div class="mt-4">
<h1 class="text-3xl">
<a href="/posts/{{ $post->slug }}">
{{ $post->title }}
</a>
</h1>
<span class="mt-2 block text-gray-400 text-xs">
Published <time>{{$post->created_at->diffForHumans()}}</time>
</span>
</div>
</header>
<div class="text-sm mt-4 space-y-4">
{!! $post->excerpt !!}
</div>
<footer class="flex justify-between items-center">
<div class="flex items-center text-sm">
<img src="/images/lary-avatar.svg" alt="Lary avatar">
<div class="ml-3 w-36">
<h5 class="font-bold">{{ $post->author->name }}</h5>
</div>
</div>
<div>
<a href="#"
class="transition-colors duration-300 text-xs font-semibold bg-gray-200 hover:bg-gray-300 rounded-full py-2 px-8"
>Read More</a>
</div>
</footer>
</div>
</div>
You need to use a flex container and make all of the boxes use grow so they fill up the height. The child boxes also need to use flex and have the middle content fill the remaining space, so it pushes down the footers of each.
I solved this by using (h-full flex flex-col) classes to the container div of all card elements and adding these classes (flex flex-col justify-between flex-1) to the container div of the title, excerpt, and author name. so in this way, the container div of the second part of the card takes the remaining height of the card.
my new code:
#props(['post'])
<article
{{ $attributes -> merge(['class' => ' transition-colors duration-300 hover:bg-gray-100 border border-black border-opacity-0 hover:border-opacity-5 rounded-xl']) }}>
<div class="py-6 px-5 h-full flex flex-col">
<div>
{{-- TODO --}}
<img src="./images/illustration-3.png" alt="Blog Post illustration" class="rounded-xl">
</div>
<div class="mt-6 flex flex-col justify-between flex-1">
<header>
<div class="space-x-2">
<x-category-button :category="$post->category" />
</div>
<div class="mt-4">
<h1 class="text-3xl clamp one-line">
<a href="/posts/{{ $post->slug }}">
{{ $post->title }}
</a>
</h1>
<span class="mt-2 block text-gray-400 text-xs">
Published <time>{{ $post->created_at->diffForHumans() }}</time>
</span>
</div>
</header>
<div class="text-sm mt-4 space-y-4">
{!! $post->excerpt !!}
</div>
<footer class="flex justify-between items-center mt-8">
<div class="flex items-center text-sm">
<img src="/images/lary-avatar.svg" alt="Lary avatar">
<div class="ml-3">
<h5 class="font-bold w-32">
{{ $post->author->name }}
</h5>
</div>
</div>
<div>
<a href="/posts/{{ $post->slug }}"
class="transition-colors duration-300 text-xs font-semibold bg-gray-200 hover:bg-gray-300 rounded-full py-2 px-8"
>Read More</a>
</div>
</footer>
</div>
</div>

How to share a list object with custom form

Am trying to share posted objects on list view but each time that I click on the share button which redirect me to share_form.html after typing into the shared textarea and submit the form it doesn't submit the shared object form, unless I use context variable {{ form }} before the object could be shared, why is it that when I use my custom form it doesn't submit the shared post? but rather when i do say {{ form }} then it's able to share the post?
Here is my view to share post
def share_post(request, pk):
original_post = Post.objects.prefetch_related('postimage_set').get(pk=pk)
form = ShareForm(request.POST, request.FILES)
if form.is_valid():
new_post1 = Post(
shared_body = request.POST.get('description'),
description = original_post.description,
username = original_post.username,
date_posted = original_post.date_posted,
video = original_post.video,
shared_on = datetime.now(),
shared_user = request.user)
new_post1.save()
for image in original_post.postimage_set.all():
new_post = PostImage(post=new_post1,
username=original_post.username,
image=image.image)
new_post.save()
return redirect('feed:feed')
ctx = {'form':form,'original_post':original_post}
return render(request,'feed/share_form.html', ctx)
My django form model to share post!
class ShareForm(forms.Form):
body = forms.CharField(label='',widget=forms.Textarea(attrs={
'rows': '3',
'placeholder': 'Say Something...'
}))
My html form to share post
<div class="main_content">
<div class="mcontainer">
<div class="md:flex md:space-x-6 lg:mx-16">
<div class="space-y-5 flex-shrink-0 md:w-7/12">
<div class="card lg:mx-0 uk-animation-slide-bottom-small">
<form method="POST" action="" enctype="multipart/form-data">
<div class="flex space-x-4 mb-5 relative">
<img src="{{ request.user.profile_image.url }}" alt="" class="rounded-full shadow w-12 h-12">
<div class="flex-1">
<form action="" method="POST" for='id_shared_body' enctype="multipart/form-data" >
{% csrf_token %}
<div class="grid md:grid-cols-2 gap-4">
<div class="col-span-2">
<textarea name="shared_body" id="id_shared_body" cols="30" rows="6" class="bg-gradient-to-b from-gray-100 to-gray-100"></textarea></div>
<a href="#" type="submit" class="flex items-center px-3 py-2 hover:bg-gray-200 hover:text-gray-800 rounded-md dark:hover:bg-gray-800">
<div class="uil-share-alt mr-1" type="submit"></div><button>Share Post</button></a>
</div>
</form>
</div>
</div>
<!-- post header-->
<div class="flex justify-between items-center lg:p-4 p-2.5">
<div class="flex flex-1 items-center space-x-4">
<a href="#">
<img src="{{original_post.username.profile_image.url }}" class="bg-gray-200 border border-white rounded-full w-10 h-10">
</a>
<div class="flex-1 font-semibold capitalize">
{{original_post.username.get_full_name}}
<div class="text-gray-700 flex items-center space-x-2"> <span> {{ original_post.date_posted|timesince }} </span> <ion-icon name="people"></ion-icon></div>
</div>
</div>
<div>
<i class="icon-feather-more-horizontal text-2xl hover:bg-gray-200 rounded-full p-2 transition -mr-1 dark:hover:bg-gray-700"></i>
<div class="bg-white w-56 shadow-md mx-auto p-2 mt-12 rounded-md text-gray-500 hidden text-base border border-gray-100 dark:bg-gray-900 dark:text-gray-100 dark:border-gray-700"
uk-drop="mode: click;pos: bottom-right;animation: uk-animation-slide-bottom-small">
<ul class="space-y-1">
<li>
<a href="#" class="flex items-center px-3 py-2 hover:bg-gray-200 hover:text-gray-800 rounded-md dark:hover:bg-gray-800">
<i class="uil-edit-alt mr-1"></i> Edit Post
</a>
</li>
<li>
<a href="#" class="flex items-center px-3 py-2 hover:bg-gray-200 hover:text-gray-800 rounded-md dark:hover:bg-gray-800">
<i class="uil-comment-slash mr-1"></i> Disable comments
</a>
</li>
<li>
<a href="#" class="flex items-center px-3 py-2 hover:bg-gray-200 hover:text-gray-800 rounded-md dark:hover:bg-gray-800">
<i class="uil-favorite mr-1"></i> Add favorites
</a>
</li>
<li>
<hr class="-mx-2 my-2 dark:border-gray-800">
</li>
<li>
<a href="#" class="flex items-center px-3 py-2 text-red-500 hover:bg-red-100 hover:text-red-500 rounded-md dark:hover:bg-red-600">
<i class="uil-trash-alt mr-1"></i> Delete
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="p-3 border-b dark:border-gray-700">
{{ original_post.description }}
</div>
{% if original_post.video %}
<div class="w-full h-full">
<video width="650" height="200" controls>
<source src="{% static original_post.video.url %}" >
</video>
</div>
{% endif %}
<div class="grid grid-cols-2 gap-2 p-2">
{% for p in original_post.postimage_set.all %}
{% if forloop.counter == 1 %}
<a href="{{ p.image.url }}" class="col-span-2">
<img src=" {{ p.image.url }} " alt="" class="rounded-md w-full lg:h-71 object-cover" >
</a>
{% endif %}
{% if forloop.counter == 2 %}
<a href="{{ p.image.url }}">
<img src="{{ p.image.url }} " alt="" class="rounded-md w-full h-full">
</a>
{% endif %}
{% if forloop.counter == 6 %}
<a href="{{ p.image.url }}" class="relative">
<img src=" {% if forloop.counter == 6 %}{{ p.image.url }}{% endif %}" alt="" class="rounded-md w-full h-full">
<div class="absolute bg-gray-900 bg-opacity-30 flex justify-center items-center text-white rounded-md inset-0 text-2xl"> + {{ forloop.counter }} more </div>
</a>
{% else %}
<a href="{{ p.image.url }}" class="relative" hidden>
<img src=" {% if forloop.counter == 3 %}{{ p.image.url }}{% endif %}" alt="" class="rounded-md w-full h-full">
<div class="absolute bg-gray-900 bg-opacity-30 flex justify-center items-center text-white rounded-md inset-0 text-2xl"> + {{ forloop.counter }} more </div>
</a>
{% endif %}
{% endfor %}
</div>
<div class="p-4 space-y-3">
<div class="flex space-x-4 lg:font-bold">
<a href="#" class="flex items-center space-x-2">
<div class="p-2 rounded-full text-black lg:bg-gray-100 dark:bg-gray-600">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="22" height="22" class="dark:text-gray-100">
<path d="M2 10.5a1.5 1.5 0 113 0v6a1.5 1.5 0 01-3 0v-6zM6 10.333v5.43a2 2 0 001.106 1.79l.05.025A4 4 0 008.943 18h5.416a2 2 0 001.962-1.608l1.2-6A2 2 0 0015.56 8H12V4a2 2 0 00-2-2 1 1 0 00-1 1v.667a4 4 0 01-.8 2.4L6.8 7.933a4 4 0 00-.8 2.4z" />
</svg>
</div>
<div> Like</div>
</a>
<a href="#" class="flex items-center space-x-2 flex-1 justify-end">
<div class="p-2 rounded-full text-black lg:bg-gray-100 dark:bg-gray-600">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="22" height="22" class="dark:text-gray-100">
<path fill-rule="evenodd" d="M18 5v8a2 2 0 01-2 2h-5l-5 4v-4H4a2 2 0 01-2-2V5a2 2 0 012-2h12a2 2 0 012 2zM7 8H5v2h2V8zm2 0h2v2H9V8zm6 0h-2v2h2V8z" clip-rule="evenodd" />
</svg>
</div>
<div> Comment</div>
</a>
</div>
{% for comment in original_post.g_comments.all %}
<div class="border-t py-4 space-y-4 dark:border-gray-600">
<div class="flex">
<div class="w-10 h-10 rounded-full relative flex-shrink-0">
<img src="" alt="" class="absolute h-full rounded-full w-full">
</div>
<div>
<div class="text-gray-700 py-2 px-3 rounded-md bg-gray-100 relative lg:ml-5 ml-2 lg:mr-12 dark:bg-gray-800 dark:text-gray-100">
<p class="leading-6">{{comment}} <i class="uil-grin-tongue-wink-alt"></i> </p>
<div class="absolute w-3 h-3 top-3 -left-1 bg-gray-100 transform rotate-45 dark:bg-gray-800"></div>
</div>
<div class="text-xs flex items-center space-x-3 mt-2 ml-5">
<i class="uil-heart"></i> Love
Replay
<span> 3d </span>
</div>
</div>
</div>
</div>
Veiw 8 more Comments
<div class="bg-gray-100 rounded-full relative dark:bg-gray-800 border-t">
<input placeholder="Add your Comment.." class="bg-transparent max-h-10 shadow-none px-5">
<div class="-m-0.5 absolute bottom-0 flex items-center right-3 text-xl">
<a href="#">
<ion-icon name="happy-outline" class="hover:bg-gray-200 p-1.5 rounded-full"></ion-icon>
</a>
<a href="#">
<ion-icon name="image-outline" class="hover:bg-gray-200 p-1.5 rounded-full"></ion-icon>
</a>
<a href="#">
<ion-icon name="link-outline" class="hover:bg-gray-200 p-1.5 rounded-full"></ion-icon>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</form>
So after i had taken sometime to carefully analyzed the issue i had stable on a solution, actually the problem was coming from the form model:
this where the problem was
class ShareForm(forms.Form):
body = forms.CharField(label='',widget=forms.Textarea(attrs={
'rows': '3',
'placeholder': 'Say Something...'
}))
Instead i should have than something like this, i had omitted the description field, which was where my problem was !
class ShareForm(forms.Form):
description = forms.CharField(
label='',
widget=forms.Textarea(attrs={
'rows': '3',
'placeholder': 'Say Something...'
}))

Django - Input boxes not styling properly when inheriting from base.html

I am creating a simple login page using Django & Tailwind.css.
My form was styling fine until I inherited a <nav> from base.html. When I did so, gray borders started appearing around my input boxes and the input boxes got slightly bigger.
The original layout:
The new layout (with base.html being inherited):
I'm not sure why this is occurring, because all of the code remains the same, I am just {% extends "base.html" %} at the top of my login.html
Here is my base.html code (contains the navar & responsive navbar):
<!DOCTYPE html>
<html class="screen-top">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}{% endblock %}</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght#400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://shuffle.dev/vendor/icons/css/fontello.css?v=h7b" id="bs-base-css">
<style type="text/css" href="https://shuffle.dev/vendor/tailwind-flex/css/tailwind.min.css?v=bd4"></style>
<style type="text/css" href="https://shuffle.dev/vendor/tailwind-flex/css/tailwind.min.css?v=bd4"></style>
<style type="text/css" href="css2?family=Poppins:wght#400;500;600;700&display=swap"></style>
<link rel="stylesheet" href="https://shuffle.dev/static/build/css/shuffle-preview.3a553ecf.css">
<link rel="stylesheet" href="https://unpkg.com/flowbite#latest/dist/flowbite.min.css" />
<script src="https://shuffle.dev/vendor/tailwind-flex/js/main.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
{% block css %}
{% endblock %}
</head>
<body id="page" class="antialiased font-body bg-body text-body bg-[rgb(248,250,251)]">
<!-- NAVBAR -->
<div class="" id="content">
<section class="relative overflow-hidden">
<nav class="flex justify-between p-6 px-4" data-config-id="toggle-mobile" data-config-target=".navbar-menu"
data-config-class="hidden" style="background-color: #2a3342;">
<div class="flex justify-between items-center w-full">
<div class="w-1/2 xl:w-1/3">
<a class="block max-w-max" href="{% url 'home' %}">
<img class="h-8" src="https://i.ibb.co/LRCrLTF/Screenshot-2022-04-03-140946-removebg-preview.png"
alt="LOGO" data-config-id="auto-img-1-2" style="transform: scale(2); padding-left: 30px"> </a>
</div>
<div class="w-1/2 xl:w-1/3">
<ul class="text-slate-400hidden xl:flex xl:justify-center">
<li class="mr-12"><a class="text-slate-400 font-medium hover:text-white transition ease-in-out delay-150"
href="#" data-config-id="auto-txt-1-2" style=" font-size: 18px">About</a></li>
<li class="mr-12"><a
class=" text-slate-400 font-medium hover:text-white transition ease-in-out delay-150"
href="{% url 'classes' %}" data-config-id="auto-txt-2-2" style=" font-size: 18px">Classes</a></li>
<li class="mr-12"><a class=" hover:text-white font-medium text-slate-400 transition ease-in-out delay-150"
href="{% url 'resources' %}" data-config-id="auto-txt-3-2" style=" font-size: 18px">Resources</a>
</li>
<li><a class=" hover:text-white font-medium text-slate-400 transition ease-in-out delay-150" href="#"
data-config-id="auto-txt-4-2" style=" font-size: 18px" id="responsivehide">Upcoming</a></li>
</ul>
</div>
<div class="w-1/2 xl:w-1/3">
<div class="hidden xl:flex items-center justify-end"><a
class="inline-block py-2 px-4 mr-2 leading-5 text-slate-400 hover:text-white bg-transparent font-medium rounded-md transition ease-in-out delay-150"
href="{% url 'login' %}" data-config-id="auto-txt-5-2" style="font-size: 18px">Log In</a><a
class="inline-block py-2 px-4 text-sm leading-5 text-green-50 border-2 border-solid border-green-500 hover:bg-green-500 transition ease-in-out delay-200 font-medium focus:ring-2 focus:ring-green-500 focus:ring-opacity-50 rounded-md"
href="#" data-config-id="auto-txt-6-2" style="font-size: 15px">Sign Up</a></div>
</div>
</div>
<button class="navbar-burger self-center xl:hidden">
<svg width="35" height="35" viewbox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"
data-config-id="auto-svg-1-2">
<rect class="text-slate-400" width="32" height="32" rx="6" fill="currentColor"></rect>
<path class="text-coolGray-400"
d="M7 12H25C25.2652 12 25.5196 11.8946 25.7071 11.7071C25.8946 11.5196 26 11.2652 26 11C26 10.7348 25.8946 10.4804 25.7071 10.2929C25.5196 10.1054 25.2652 10 25 10H7C6.73478 10 6.48043 10.1054 6.29289 10.2929C6.10536 10.4804 6 10.7348 6 11C6 11.2652 6.10536 11.5196 6.29289 11.7071C6.48043 11.8946 6.73478 12 7 12ZM25 15H7C6.73478 15 6.48043 15.1054 6.29289 15.2929C6.10536 15.4804 6 15.7348 6 16C6 16.2652 6.10536 16.5196 6.29289 16.7071C6.48043 16.8946 6.73478 17 7 17H25C25.2652 17 25.5196 16.8946 25.7071 16.7071C25.8946 16.5196 26 16.2652 26 16C26 15.7348 25.8946 15.4804 25.7071 15.2929C25.5196 15.1054 25.2652 15 25 15ZM25 20H7C6.73478 20 6.48043 20.1054 6.29289 20.2929C6.10536 20.4804 6 20.7348 6 21C6 21.2652 6.10536 21.5196 6.29289 21.7071C6.48043 21.8946 6.73478 22 7 22H25C25.2652 22 25.5196 21.8946 25.7071 21.7071C25.8946 21.5196 26 21.2652 26 21C26 20.7348 25.8946 20.4804 25.7071 20.2929C25.5196 20.1054 25.2652 20 25 20Z"
fill="currentColor"></path>
</svg></button>
</nav>
<!--NAVBAR ENDING-->
<!--Navbar script & styles-->
<script>
for (var i = 0; i < links.length; i += 1) {
links[i].addEventListener('click', function (e) {
e.preventDefault();
});
}
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i += 1) {
forms[i].addEventListener('submit', function (e) {
e.preventDefault();
}, true);
}
</script>
<style>
#media screen and (min-width: 0px) and (max-width: 1273px) {
.mr-12 {
display: none;
}
#responsivehide {
display: none;
}
}
</style>
<div class="navbar-menu hidden fixed top-0 z-50 left-0 w-full h-full bg-coolGray-900 bg-opacity-50">
<div class="fixed top-0 left-0 bottom-0 w-full w-4/6 max-w-xs bg-coolGray-900" data-config-id="toggle-mobile-2"
data-config-target=".navbar-menu" data-config-class="hidden">
</div>
</div>
<!--Hidden navbar-->
<div class="hidden navbar-menu fixed top-0 left-0 bottom-0 w-5/6 max-w-sm z-50">
<div class="navbar-backdrop fixed inset-0 bg-gray-800 opacity-25"></div>
<nav class="relative flex flex-col py-6 px-6 h-full w-full bg-white border-r overflow-y-auto"
style="background-color: #2A3342;">
<div class="flex items-center mb-8 ">
<img class="h-8" src="https://i.ibb.co/LRCrLTF/Screenshot-2022-04-03-140946-removebg-preview.png" alt="LOGO"
data-config-id="auto-img-1-2" style="transform: scale(2); padding-left: 30px"> </a>
<a class="mr-auto text-3xl font-bold leading-none" href="#">
<img class="h-10" src="atis-assets/logo/atis/atis-mono-black.svg" alt="" width="auto">
</a>
<button class="navbar-close">
<svg class="h-6 w-6 text-gray-400 cursor-pointer hover:text-gray-500" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div>
<ul>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">About</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Classes</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Recources</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Upcoming</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Contact Us!</a></li>
</ul>
</div>
<div class="mt-auto">
<div class="pt-6"><a
class="block px-4 py-3 mb-3 leading-loose text-xs text-center font-semibold leading-none bg-slate-400 hover:bg-gray-100 rounded-l-xl rounded-t-xl transition ease-in-out delay-150 text-white bg-slate-700 hover:bg-slate-400 focus:ring-4 focus:outline-none focus:ring-slate-300 font-medium rounded-lg text-base px-6 py-3.5 text-center dark:bg-slate-600 dark:hover:bg-slate-700 dark:focus:ring-slate-800"
href="{% url 'login' %}">Sign In</a><a
class="block px-4 py-3 mb-3 leading-loose text-xs text-center font-semibold leading-none bg-green-400 hover:bg-green-100 rounded-l-xl rounded-t-xl transition ease-in-out delay-150 text-white bg-green-700 hover:bg-green-400 focus:ring-4 focus:outline-none focus:ring-green-300 font-medium rounded-lg text-base px-6 py-3.5 text-center dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
href="#">Sign Up</a></div>
<p class="my-4 text-xs text-center text-gray-400">
<span>© 2022 All rights reserved.</span>
</p>
</div>
</nav>
</div>
{% block content %}
{% endblock %}
{% block js %}
{% endblock %}
</section>
</div>
</body>
</html>
And here is my login.html (contains the login form):
{% extends "base.html" %}
{% block title %}Saroga | Login {% endblock %}
{% block content %}
<section class="bg-slate-900">
<div class="flex flex-wrap h-screen">
<div class="pt-7 lg:pt-16 pb-6 w-full lg:w-1/2" >
<div class="max-w-md mx-auto">
<div>
<div class="mb-7 px-3">
<span class="text-gray-400 text-xl ">Join a yoga session today!</span>
<h3 class="text-3xl font-bold text-white" style="padding-top: 3%">Login to your account</h3>
</div>
<form action="" method="POST">
{% csrf_token %}
<div class="flex flex-wrap">
</div>
<label for="username" class = "ml-2 text-green-500">Username:</label>
<div class="mb-3 mt-1 flex p-4 mx-2 bg-gray-800 rounded">
<input class="w-full text-medium text-gray-50 bg-gray-800 outline-none " id = "username" name="username" type="text" placeholder="ex: username"
<button>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user-circle" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="#d4d4dc" fill="none" stroke-linecap="round" stroke-linejoin="round" style = "transform: scale(1.1) ;">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<circle cx="12" cy="12" r="9"></circle>
<circle cx="12" cy="10" r="3"></circle>
<path d="M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855"></path>
</svg>
</button>
</div>
<label for="username" class = "ml-2 text-green-500">Password:</label>
<div class="mb-6 flex p-4 mx-2 bg-gray-800 rounded mt-1">
<input class="w-full text-medium text-gray-50 bg-gray-800 outline-none" type="password" name="password" placeholder="**********">
<button>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="#d4d4dc" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</button>
</div>
<div class="px-3 text-center">
<button class="mb-2 w-full py-4 bg-green-500 hover:bg-green-700 rounded text-sm font-extrabold text-base text-gray-50 transition duration-200 " style="margin-bottom: 7%">Log In!</button>
<span class="text-gray-400 text-md ">
<span>Don't have an account?</span>
<a class="text-green-600 hover:underline" href="#">Create One Today!</a>
</span>
<p class="mt-16 text-md text-gray-400"><a class="text-green-600" href="#">Please read our</a> <a class="underline hover:text-gray-500" href="{% url 'privacyPolicy'%}">Privacy Policy</a> and <a class="underline hover:text-gray-500" href="{% url 'termsOfUse'%}">Terms of Use</a></p>
</div>
</form>
</div>
</div>
</div>
<div class="hidden lg:block relative w-full lg:w-1/2 bg-green-600">
<div class="absolute bottom-0 inset-x-0 mx-auto mb-12 max-w-xl text-center" style="z-index: 10;">
<img class="lg:max-w-xl mx-auto" src="https://i.ibb.co/7pH88PM/Woman-in-yoga-pose-removebg-preview-removebg-preview-1-1.png" style="position: relative; bottom: 150px">
<h2 class="mb-2 text-2xl text-white font-bold" style="position: relative; bottom: 100px">"Yoga shapes the soul, the mind, and the body"</h2>
<div class="max-w-lg mx-auto">
<p class="mb-6 text-gray-50 leading-loose" style="position: relative; bottom: 70px">Yoga is a truly benefical activity, packed with fun, simplicity, and flexibility. Join a yoga session today or visit the <a href = "{% url 'resources'%}" class="underline decoration-slate-500 font-bold decoration-4" > resources</a> page to learn more! </p>
</div> <script> for (var i = 0; i < quoteList.length; i ++) {return yoga_app.quote(i); } </script>
</div>
</div>
<div class="lg:hidden bg-green-600 w-full">
<div class="py-10 px-3 text-center" style="z-index: 10;">
<h2 class="mb-2 text-2xl text-white font-bold">"Yoga shapes the soul, the mind, and the body"</h2>
<p class="mb-6 text-gray-50 leading-loose">Yoga is a truly benefical activity, packed with fun, simplicity, and flexibility. Join a yoga session today or visit the <a href = "{% url 'resources'%}" class="underline decoration-slate-500 font-bold decoration-4" > resources</a> page to learn more!</p>
</div>
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script>
for (var i = 0; i < links.length; i += 1) {
links[i].addEventListener('click', function (e) {
e.preventDefault();
});
}
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i += 1) {
forms[i].addEventListener('submit', function (e) {
e.preventDefault();
}, true);
}
</script>
{% endblock %}
{% block css %}
<style>
#media screen and (min-width: 0px) and (max-width: 1272px) {
.mr-12 { display: none; }
#responsivehide { display: none; }
}
</style>
{% endblock %}
Can someone please help me find out why the input boxes are styling weirdly, and how I can solve it?

Input boxes styling weirdly when using Django & Tailwind.css

I am creating a simple login page using Django & Tailwind.css.
My form was styling fine until I inherited a <nav> from base.html. When I did so, gray borders started appearing around my input boxes and the input boxes got slightly bigger.
The original layout:
https://ibb.co/vXxgrH0
The new layout (with base.html being inherited):
https://ibb.co/QCsvKmz
I'm not sure why this is occurring, because all of the code remains the same, I am just {% extends "base.html" %} at the top of my login.html
Here is my base.html code (contains the navar & responsive navbar):
<!DOCTYPE html>
<html class="screen-top">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}{% endblock %}</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght#400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://shuffle.dev/vendor/icons/css/fontello.css?v=h7b" id="bs-base-css">
<style type="text/css" href="https://shuffle.dev/vendor/tailwind-flex/css/tailwind.min.css?v=bd4"></style>
<style type="text/css" href="https://shuffle.dev/vendor/tailwind-flex/css/tailwind.min.css?v=bd4"></style>
<style type="text/css" href="css2?family=Poppins:wght#400;500;600;700&display=swap"></style>
<link rel="stylesheet" href="https://shuffle.dev/static/build/css/shuffle-preview.3a553ecf.css">
<link rel="stylesheet" href="https://unpkg.com/flowbite#latest/dist/flowbite.min.css" />
<script src="https://shuffle.dev/vendor/tailwind-flex/js/main.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
{% block css %}
{% endblock %}
</head>
<body id="page" class="antialiased font-body bg-body text-body bg-[rgb(248,250,251)]">
<!-- NAVBAR -->
<div class="" id="content">
<section class="relative overflow-hidden">
<nav class="flex justify-between p-6 px-4" data-config-id="toggle-mobile" data-config-target=".navbar-menu"
data-config-class="hidden" style="background-color: #2a3342;">
<div class="flex justify-between items-center w-full">
<div class="w-1/2 xl:w-1/3">
<a class="block max-w-max" href="{% url 'home' %}">
<img class="h-8" src="https://i.ibb.co/LRCrLTF/Screenshot-2022-04-03-140946-removebg-preview.png"
alt="LOGO" data-config-id="auto-img-1-2" style="transform: scale(2); padding-left: 30px"> </a>
</div>
<div class="w-1/2 xl:w-1/3">
<ul class="text-slate-400hidden xl:flex xl:justify-center">
<li class="mr-12"><a class="text-slate-400 font-medium hover:text-white transition ease-in-out delay-150"
href="#" data-config-id="auto-txt-1-2" style=" font-size: 18px">About</a></li>
<li class="mr-12"><a
class=" text-slate-400 font-medium hover:text-white transition ease-in-out delay-150"
href="{% url 'classes' %}" data-config-id="auto-txt-2-2" style=" font-size: 18px">Classes</a></li>
<li class="mr-12"><a class=" hover:text-white font-medium text-slate-400 transition ease-in-out delay-150"
href="{% url 'resources' %}" data-config-id="auto-txt-3-2" style=" font-size: 18px">Resources</a>
</li>
<li><a class=" hover:text-white font-medium text-slate-400 transition ease-in-out delay-150" href="#"
data-config-id="auto-txt-4-2" style=" font-size: 18px" id="responsivehide">Upcoming</a></li>
</ul>
</div>
<div class="w-1/2 xl:w-1/3">
<div class="hidden xl:flex items-center justify-end"><a
class="inline-block py-2 px-4 mr-2 leading-5 text-slate-400 hover:text-white bg-transparent font-medium rounded-md transition ease-in-out delay-150"
href="{% url 'login' %}" data-config-id="auto-txt-5-2" style="font-size: 18px">Log In</a><a
class="inline-block py-2 px-4 text-sm leading-5 text-green-50 border-2 border-solid border-green-500 hover:bg-green-500 transition ease-in-out delay-200 font-medium focus:ring-2 focus:ring-green-500 focus:ring-opacity-50 rounded-md"
href="#" data-config-id="auto-txt-6-2" style="font-size: 15px">Sign Up</a></div>
</div>
</div>
<button class="navbar-burger self-center xl:hidden">
<svg width="35" height="35" viewbox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"
data-config-id="auto-svg-1-2">
<rect class="text-slate-400" width="32" height="32" rx="6" fill="currentColor"></rect>
<path class="text-coolGray-400"
d="M7 12H25C25.2652 12 25.5196 11.8946 25.7071 11.7071C25.8946 11.5196 26 11.2652 26 11C26 10.7348 25.8946 10.4804 25.7071 10.2929C25.5196 10.1054 25.2652 10 25 10H7C6.73478 10 6.48043 10.1054 6.29289 10.2929C6.10536 10.4804 6 10.7348 6 11C6 11.2652 6.10536 11.5196 6.29289 11.7071C6.48043 11.8946 6.73478 12 7 12ZM25 15H7C6.73478 15 6.48043 15.1054 6.29289 15.2929C6.10536 15.4804 6 15.7348 6 16C6 16.2652 6.10536 16.5196 6.29289 16.7071C6.48043 16.8946 6.73478 17 7 17H25C25.2652 17 25.5196 16.8946 25.7071 16.7071C25.8946 16.5196 26 16.2652 26 16C26 15.7348 25.8946 15.4804 25.7071 15.2929C25.5196 15.1054 25.2652 15 25 15ZM25 20H7C6.73478 20 6.48043 20.1054 6.29289 20.2929C6.10536 20.4804 6 20.7348 6 21C6 21.2652 6.10536 21.5196 6.29289 21.7071C6.48043 21.8946 6.73478 22 7 22H25C25.2652 22 25.5196 21.8946 25.7071 21.7071C25.8946 21.5196 26 21.2652 26 21C26 20.7348 25.8946 20.4804 25.7071 20.2929C25.5196 20.1054 25.2652 20 25 20Z"
fill="currentColor"></path>
</svg></button>
</nav>
<!--NAVBAR ENDING-->
<!--Navbar script & styles-->
<script>
for (var i = 0; i < links.length; i += 1) {
links[i].addEventListener('click', function (e) {
e.preventDefault();
});
}
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i += 1) {
forms[i].addEventListener('submit', function (e) {
e.preventDefault();
}, true);
}
</script>
<style>
#media screen and (min-width: 0px) and (max-width: 1273px) {
.mr-12 {
display: none;
}
#responsivehide {
display: none;
}
}
</style>
<div class="navbar-menu hidden fixed top-0 z-50 left-0 w-full h-full bg-coolGray-900 bg-opacity-50">
<div class="fixed top-0 left-0 bottom-0 w-full w-4/6 max-w-xs bg-coolGray-900" data-config-id="toggle-mobile-2"
data-config-target=".navbar-menu" data-config-class="hidden">
</div>
</div>
<!--Hidden navbar-->
<div class="hidden navbar-menu fixed top-0 left-0 bottom-0 w-5/6 max-w-sm z-50">
<div class="navbar-backdrop fixed inset-0 bg-gray-800 opacity-25"></div>
<nav class="relative flex flex-col py-6 px-6 h-full w-full bg-white border-r overflow-y-auto"
style="background-color: #2A3342;">
<div class="flex items-center mb-8 ">
<img class="h-8" src="https://i.ibb.co/LRCrLTF/Screenshot-2022-04-03-140946-removebg-preview.png" alt="LOGO"
data-config-id="auto-img-1-2" style="transform: scale(2); padding-left: 30px"> </a>
<a class="mr-auto text-3xl font-bold leading-none" href="#">
<img class="h-10" src="atis-assets/logo/atis/atis-mono-black.svg" alt="" width="auto">
</a>
<button class="navbar-close">
<svg class="h-6 w-6 text-gray-400 cursor-pointer hover:text-gray-500" xmlns="http://www.w3.org/2000/svg"
fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div>
<ul>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">About</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Classes</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Recources</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Upcoming</a></li>
<li class="mb-1"><a
class="block p-4 text-sm font-semibold text-gray-400 hover:bg-green-50 hover:text-green-600 rounded"
href="#">Contact Us!</a></li>
</ul>
</div>
<div class="mt-auto">
<div class="pt-6"><a
class="block px-4 py-3 mb-3 leading-loose text-xs text-center font-semibold leading-none bg-slate-400 hover:bg-gray-100 rounded-l-xl rounded-t-xl transition ease-in-out delay-150 text-white bg-slate-700 hover:bg-slate-400 focus:ring-4 focus:outline-none focus:ring-slate-300 font-medium rounded-lg text-base px-6 py-3.5 text-center dark:bg-slate-600 dark:hover:bg-slate-700 dark:focus:ring-slate-800"
href="{% url 'login' %}">Sign In</a><a
class="block px-4 py-3 mb-3 leading-loose text-xs text-center font-semibold leading-none bg-green-400 hover:bg-green-100 rounded-l-xl rounded-t-xl transition ease-in-out delay-150 text-white bg-green-700 hover:bg-green-400 focus:ring-4 focus:outline-none focus:ring-green-300 font-medium rounded-lg text-base px-6 py-3.5 text-center dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
href="#">Sign Up</a></div>
<p class="my-4 text-xs text-center text-gray-400">
<span>© 2022 All rights reserved.</span>
</p>
</div>
</nav>
</div>
{% block content %}
{% endblock %}
{% block js %}
{% endblock %}
</section>
</div>
</body>
</html>
And here is my login.html (contains the login form):
{% extends "base.html" %}
{% block title %}Saroga | Login {% endblock %}
{% block content %}
<section class="bg-slate-900">
<div class="flex flex-wrap h-screen">
<div class="pt-7 lg:pt-16 pb-6 w-full lg:w-1/2" >
<div class="max-w-md mx-auto">
<div>
<div class="mb-7 px-3">
<span class="text-gray-400 text-xl ">Join a yoga session today!</span>
<h3 class="text-3xl font-bold text-white" style="padding-top: 3%">Login to your account</h3>
</div>
<form action="" method="POST">
{% csrf_token %}
<div class="flex flex-wrap">
</div>
<label for="username" class = "ml-2 text-green-500">Username:</label>
<div class="mb-3 mt-1 flex p-4 mx-2 bg-gray-800 rounded">
<input class="w-full text-medium text-gray-50 bg-gray-800 outline-none " id = "username" name="username" type="text" placeholder="ex: username"
<button>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user-circle" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="#d4d4dc" fill="none" stroke-linecap="round" stroke-linejoin="round" style = "transform: scale(1.1) ;">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<circle cx="12" cy="12" r="9"></circle>
<circle cx="12" cy="10" r="3"></circle>
<path d="M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855"></path>
</svg>
</button>
</div>
<label for="username" class = "ml-2 text-green-500">Password:</label>
<div class="mb-6 flex p-4 mx-2 bg-gray-800 rounded mt-1">
<input class="w-full text-medium text-gray-50 bg-gray-800 outline-none" type="password" name="password" placeholder="**********">
<button>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="#d4d4dc" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</button>
</div>
<div class="px-3 text-center">
<button class="mb-2 w-full py-4 bg-green-500 hover:bg-green-700 rounded text-sm font-extrabold text-base text-gray-50 transition duration-200 " style="margin-bottom: 7%">Log In!</button>
<span class="text-gray-400 text-md ">
<span>Don't have an account?</span>
<a class="text-green-600 hover:underline" href="#">Create One Today!</a>
</span>
<p class="mt-16 text-md text-gray-400"><a class="text-green-600" href="#">Please read our</a> <a class="underline hover:text-gray-500" href="{% url 'privacyPolicy'%}">Privacy Policy</a> and <a class="underline hover:text-gray-500" href="{% url 'termsOfUse'%}">Terms of Use</a></p>
</div>
</form>
</div>
</div>
</div>
<div class="hidden lg:block relative w-full lg:w-1/2 bg-green-600">
<div class="absolute bottom-0 inset-x-0 mx-auto mb-12 max-w-xl text-center" style="z-index: 10;">
<img class="lg:max-w-xl mx-auto" src="https://i.ibb.co/7pH88PM/Woman-in-yoga-pose-removebg-preview-removebg-preview-1-1.png" style="position: relative; bottom: 150px">
<h2 class="mb-2 text-2xl text-white font-bold" style="position: relative; bottom: 100px">"Yoga shapes the soul, the mind, and the body"</h2>
<div class="max-w-lg mx-auto">
<p class="mb-6 text-gray-50 leading-loose" style="position: relative; bottom: 70px">Yoga is a truly benefical activity, packed with fun, simplicity, and flexibility. Join a yoga session today or visit the <a href = "{% url 'resources'%}" class="underline decoration-slate-500 font-bold decoration-4" > resources</a> page to learn more! </p>
</div> <script> for (var i = 0; i < quoteList.length; i ++) {return yoga_app.quote(i); } </script>
</div>
</div>
<div class="lg:hidden bg-green-600 w-full">
<div class="py-10 px-3 text-center" style="z-index: 10;">
<h2 class="mb-2 text-2xl text-white font-bold">"Yoga shapes the soul, the mind, and the body"</h2>
<p class="mb-6 text-gray-50 leading-loose">Yoga is a truly benefical activity, packed with fun, simplicity, and flexibility. Join a yoga session today or visit the <a href = "{% url 'resources'%}" class="underline decoration-slate-500 font-bold decoration-4" > resources</a> page to learn more!</p>
</div>
</div>
</div>
</section>
{% endblock %}
{% block js %}
<script>
for (var i = 0; i < links.length; i += 1) {
links[i].addEventListener('click', function (e) {
e.preventDefault();
});
}
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i += 1) {
forms[i].addEventListener('submit', function (e) {
e.preventDefault();
}, true);
}
</script>
{% endblock %}
{% block css %}
<style>
#media screen and (min-width: 0px) and (max-width: 1272px) {
.mr-12 { display: none; }
#responsivehide { display: none; }
}
</style>
{% endblock %}
Can someone please help me find out why the input boxes are styling weirdly, and how I can solve it?

Always show dropdown directly below button with flexbox

I have created the following responsive navigation bar with Tailwind and have a problem with the dropdown button ("Folgen") which shows the content always somewhere else on the x-axis than the button (depending on the window width).
How could I make sure that the dropdown always stays within the browser window (no overflow outside of the window) and stay close to the button depending on the browser width?
<nav class="bg-blue-800 shadow-lg sticky top-0 z-50 h-[3.75rem]">
<div class="max-w-6xl mx-auto px-4 h-[3.75rem]">
<div class="flex justify-between h-[3.75rem]">
<div class="flex space-x-7">
<div>
<!-- Website Logo -->
<a class="flex items-center py-4 px-2 text-white font-bold text-lg" href="<?= $site->url() ?>"><?= $site->title()->html() ?></a>
</a>
</div>
<!-- Primary Navbar items -->
<div class="hidden md:flex items-center space-x-1">
<?php foreach ($site->children()->listed() as $item): ?>
<a class="py-4 px-2 text-white font-semibold hover:text-white-500 hover:bg-blue-500 transition duration-300" <?php e($item->isOpen(), 'aria-current ') ?> href="<?= $item->url() ?>"><?= $item->title()->html() ?></a>
<?php endforeach ?>
</div>
</div>
<!-- This is a search component -->
<ul class="flex items-center ml-auto space-x-1">
<div class="md:flex hidden items-center ml-auto bg-blue-800 space-x-1 pr-4">
<form method="post" action="<?= page('search')->url() ?>">
<div class="relative text-gray-600 focus-within:text-gray-800">
<span class="absolute inset-y-0 left-0 flex items-center pl-2">
<button type="submit" class="p-1 focus:outline-none focus:shadow-outline">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-6 h-6"><path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
</button>
</span>
<input type="search" name="q" class="py-2 text-sm text-gray-900 bg-white rounded-md pl-10 focus:outline-none focus:bg-white focus:text-gray-900" placeholder="Suche..." value="<?php echo (!empty($query)) ? esc($query) : '' ?>" autocomplete="off">
</div>
</form>
</div>
<!-- Language selector -->
<?php foreach($kirby->languages()->not($kirby->language()) as $language): ?>
<?php if ($page->translation($language->code())->exists()): ?>
<?= svg('assets/icons/OOjs_UI_icon_language-ltr-invert.svg') ?>
<li <?php e($kirby->language() == $language, ' class="active text-white"') ?>>
<a href="<?= $page->url($language->code()) ?>" hreflang="<?php echo $language->code() ?>" class="text-white">
<?= html($language->name()) ?>
</a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
<!-- Social Navbar items -->
<div class="group hidden md:flex">
<button
class="outline-none focus:outline-none px-3 py-1 bg-blue-800 text-white rounded-sm flex items-center min-w-32"
>
<span class="pr-1 font-semibold flex-1">Folgen</span>
<span>
<svg
class="fill-current h-4 w-4 transform group-hover:-rotate-180
transition duration-150 ease-in-out"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
>
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
/>
</svg>
</span>
</button>
<ul
class="bg-gray-200 inline-flex transform scale-0 group-hover:scale-100 absolute transition duration-150 ease-in-out origin-top top-full right-0 left-auto"
>
<li class="items-center inline-flex py-2"><?php snippet('social') ?></li>
</ul>
</div>
<!-- Mobile menu button -->
<div class="md:hidden flex ml-4 items-center">
<button class="outline-none mobile-menu-button" aria-label="Navigation icon">
<svg class=" w-7 h-7 text-white hover:text-blue-500 "
x-show="!showMenu"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</div>
</div>
</div>
<!-- mobile menu -->
<div class="hidden mobile-menu text-center bg-blue-600">
<ul class="inline-block">
<?php foreach ($site->children()->listed() as $item): ?>
<li><a class="block px-2 py-4 text-white hover:bg-blue-500 transition duration-300" <?php e($item->isOpen(), 'aria-current ') ?> href="<?= $item->url() ?>"><?= $item->title()->html() ?></a></li>
<?php endforeach ?>
<div class="inline-flex px-2 py-4">
<form method="post" action="<?= page('search')->url() ?>">
<div class="relative text-gray-600 focus-within:text-gray-800">
<span class="absolute inset-y-0 left-0 flex items-center pl-2">
<button type="submit" class="p-1 focus:outline-none focus:shadow-outline">
<svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" class="w-6 h-6"><path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
</button>
</span>
<input type="search" name="q" class="py-2 text-sm text-gray-900 bg-white rounded-md pl-10 focus:outline-none focus:bg-white focus:text-gray-900" placeholder="Suche..." value="<?php echo (!empty($query)) ? esc($query) : '' ?>">
</div>
</form>
</div>
<div class="inline-flex px-2 py-4 text-white filter invert"><?php snippet('social') ?></div>
</ul>
</div>
<script>
const btn = document.querySelector("button.mobile-menu-button");
const menu = document.querySelector(".mobile-menu");
btn.addEventListener("click", () => {
menu.classList.toggle("hidden");
});
</script>
</nav>
You can find a working example over here.
You can add relative class on the container which contains the button and the dropdown. Your dropdown, which has the right-0 class, will then be positioned on the right edge of the container instead of the browser window like it is now. Working example here.