Link using id tag hides Title content of a div - html

So i have been working on a project. But Clicking on Footer link hides the title portion of the id like the 2nd image . is there any way to show it like the 3rd pic . Tried adding padding top to the id element still not working. Showing this
Want to show like this
My Footer Code
<!-- Tailwind -->
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
<!-- Body -->
<div class="w-full px-4 md:w-1/3">
<h2 class="mb-3 text-2xl tracking-widest title-font text-textC font-futuraB">
TOP SERVICES</h2>
<ul class="mb-10 list-none font-futuraL">
<li class="py-0.5">
Brand strategy
</li>
<li class="py-0.5">
Identity Design
</li>
<li class="py-0.5">
Marketing & Development
</li>
<li class="py-0.5">
<a rel="noopener noreferrer" href="http://ignition.brandheft.com/" class="text-textAltC hover:text-accentC">Printing Services</a>
</li>
</ul>
</div>
Div Element having the issue
<!-- Tailwind -->
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
<!-- Body -->
<div class="flex flex-wrap justify-center mx-auto lg:w-4/5 service_container_1" id="strategy">
<div class="order-first object-cover object-center rounded lg:w-1/2">
<img class="w-full h-72 lg:h-auto service_img_1" src="https://via.placeholder.com/300.jpg">
</div>
<div class="w-full my-auto mb-6 text-center lg:w-1/2 lg:pr-10 lg:py-6 lg:mb-0 font-futuraM lg:text-left">
<h1 class="pt-12 mb-4 text-5xl font-medium text-textC">Brand Strategy</h1>
<p class="mb-4 text-base leading-relaxed lg:text-lg text-textAltC first-letter:text-accentC first-letter:text-xl lg:first-letter:text-2xl font-futuraL">Whether you want to be remembered by your customers, connect with your audience, or increase the prices of your products by showing them the value, you need to differentiate yourself from your competitors. Differentiating doesn't always mean providing
a totally different product or service. Differentiating means adding a little something extra that'll make a huge impact. That naturally comes from your vision but you need to mine it using a proper brand strategy. A brand strategy encompasses your
company's mission, promises to your customers, and a plan to communicate the same to your audience. Here's how we can help you draft a successful brand strategy.</p>
<div class="space-y-2">
<div class="flex flex-col justify-between space-y-2 lg:space-y-0 lg:flex-row">
<span class="text-accentC">Brand purpose</span>
<span class="text-accentC">Target audience</span>
</div>
<div class="flex flex-col justify-between space-y-2 lg:space-y-0 lg:flex-row">
<span class="text-accentC">Brand attributes</span>
<span class="text-accentC">Brand book</span>
</div>
<div class="flex flex-col justify-between space-y-2 lg:space-y-0 lg:flex-row">
<span class="text-accentC">Brand mission statement</span>
<span class="text-accentC">Brand voice</span>
</div>
<div class="flex flex-col justify-between space-y-2 lg:space-y-0 lg:flex-row">
<span class="text-accentC">Brand personality</span>
<span class="text-accentC">Brand kit</span>
</div>
</div>
<div class="flex mt-10">
Get a Quote
</div>
</div>
</div>
LIVE WEBSITE

Related

Aligning bar chart columns and text with CSS

I have a component where the generated HTML is for a simplistic bar chart. The height and background colour are computed in the component. This works fine but I want to solve the issue of long text causing displacement of the bar above it.
There is also the issue of the width of the bars wrongly depending on the width of the text too, but that's probably another post.
Chart when viewport is wide enough:
Chart when viewport is smaller (this is the problem I wish to solve):
I think the rest of the bars and their labels need offsetting?
<ul class="flex gap-3 items-end">
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:42.666666666666664px;background-color:#d73027" title="Apple - 10">
</span>
<div class="text-sm text-center">Apple</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:128px;background-color:#f46d43" title="Very Long Banana - 30">
</span>
<div class="text-sm text-center">Very Long Banana</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:64px;background-color:#fdae61" title="Orange - 15">
</span>
<div class="text-sm text-center">Orange</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:106.66666666666667px;background-color:#fee08b" title="Grape - 25">
</span>
<div class="text-sm text-center">Grape</div>
</li>
</ul>
</div>
As someone mentioned in the comments, there are various ways to solve the issues, this is just one way.
Edit: See #MagnusEffect's answer for a much simpler option.
If you want to keep your layout as it is, i.e., using an unordered list as a container for both the bars and the labels, you can wrap all bars with a fixed size div for the vertical alignment. Otherwise you could divide the bars and the labels in two different rows with equally sized items. I positioned the items within the wrapper divs using absolute positioning of the children, you can use flex box here as well.
You can use flex-basis together with word-wrap for equal widths across the flex items. Some kind of overflow for the text can be an alternative to word-wrap.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<ul class="flex gap-3 items-start" style="width: 270px; resize: both; overflow: auto; border: 1px solid black">
<li class="flex flex-col basis-0 flex-grow gap-1">
<div class="relative" style="height: 128px;">
<span class="absolute w-full bottom-0" style="height:42.666666666666664px;background-color:#d73027" title="Apple - 10"></span>
</div>
<div class="text-sm text-center" style="word-wrap: anywhere;">Apple</div>
</li>
<li class="flex flex-col basis-0 flex-grow gap-1">
<div class="relative" style="height: 128px">
<span class="absolute w-full bottom-0" style="height:128px;background-color:#f46d43" title="Very Long Banana - 30"></span>
</div>
<div class="text-sm text-center" style="word-wrap: anywhere;">Very Long Banana</div>
</li>
<li class="flex flex-col basis-0 flex-grow gap-1">
<div class="relative" style="height: 128px">
<span class="absolute w-full bottom-0" style="height:64px;background-color:#fdae61" title="Orange - 15"></span>
</div>
<div class="text-sm text-center" style="word-wrap: anywhere;">Orange</div>
</li>
<li class="flex flex-col basis-0 flex-grow gap-1">
<div class="relative" style="height: 128px">
<span class="absolute w-full bottom-0" style="height:106.66666666666667px;background-color:#fee08b" title="Grape - 25"></span>
</div>
<div class="text-sm text-center" style="word-wrap: anywhere;">Grape</div>
</li>
</ul>
</body>
</html>
As mentioned , since you are using items-end , it is using the end (text) to align the object.
Replace it with items-baseline class and also add flex-row to the <ul>.
So the code looks like this
<ul class="flex gap-3 flex-row items-baseline">
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:42.666666666666664px;background-color:#d73027" title="Apple - 10">
</span>
<div class="text-sm text-center">Apple</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:128px;background-color:#f46d43" title="Very Long Banana - 30">
</span>
<div class="text-sm text-center">Very Long Banana</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:64px;background-color:#fdae61" title="Orange - 15">
</span>
<div class="text-sm text-center">Orange</div>
</li>
<li class="flex flex-col flex-grow gap-1 content-center">
<span style="height:106.66666666666667px;background-color:#fee08b" title="Grape - 25">
</span>
<div class="text-sm text-center">Grape</div>
</li>
</ul>
</div>
You can check the demonstration here on tailwind play
Please try to add the CSS for the text using VW method.
Example: font-size: 16vw;
Please check below reference link:
https://css-tricks.com/viewport-sized-typography/

Reduce tailwind image to the smallest

I have added images on my page using tailwinds but on mobile, the image still appears to be bigger than I want.
My code below:
<script src="https://cdn.tailwindcss.com"></script>
<div class="max-w-md mx-auto bg-white hover:bg-gray-200 py-3 px-6 border-b border-gray-300 overflow-hidden md:max-w-2xl">
<div class="flex">
<div class="md:shrink-0">
<img class="h-40 w-full scale-75 object-cover md:h-full md:w-48" src="https://images.unsplash.com/photo-1488998427799-e3362cec87c3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80" alt="Man looking at item at a store">
</div>
<div class="p-4">
<div class="uppercase tracking-wide text-sm text-indigo-500 font-light">Course</div>
How to Organize Your Time and Your Life
<p class="mt-2 ">By: Pete Mockaitis | How to Be Awesome at Your Job</p>
<span class="text-sm text-slate-500">134,768 Viewers. Released Jun 19, 2022</span>
</div>
</div>
</div>
What I get
What I want
I think the best way to make a website responsive is by using display: grid;>. I think this solves your problem:
<script src="https://cdn.tailwindcss.com"></script>
<div class="max-w-md mx-auto bg-white hover:bg-gray-200 py-3 px-6 border-b border-gray-300 overflow-hidden md:max-w-2xl grid grid-cols-3 gap-4">
<img class="h-30 w-full col-span-1 object-cover md:h-full md:w-48" src="https://images.unsplash.com/photo-1488998427799-e3362cec87c3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80" alt="Man looking at item at a store">
<div class="col-span-2">
<div class="uppercase tracking-wide text-sm text-indigo-500 font-light">Course</div>
How to Organize Your Time and Your Life
<p class="mt-2 ">By: Pete Mockaitis | How to Be Awesome at Your Job</p>
<span class="text-sm text-slate-500">134,768 Viewers. Released Jun 19, 2022</span>
</div>
</div>

Different items height inside of div when using flexbox(TailwindCSS)

I am using Flex in tailwind in one my main div container to align the items inside of it horizontal
but somehow the items are of different sizes in the row the image link is below any fixes for it?
i have tried using height utility class but it just messes up the entire page.
[1]: https://i.stack.imgur.com/Yjs51.jpg
HOME
ORDERS
MENU CARD
FAQs
ABOUT
Butter Chicken
If you haven't tried butter chicken, you don't know what you'r missing.
</div>
</div>
</a>
<a href="butterchicken.html">
<div class="max-w-sm rounded overflow-hidden shadow-lg justify-center">
<img class= "w-full" src="images/download (1).jpg" alt="malai-chicken">
<div class="px-6 py-8">
<div class="font-extrabold text-xl pb-3">Malai Chicken</div>
<div>
<p class=" font-serif text-base mb-3">Clean as white and appetizing.</p>
</div>
</div>
</div>
</a>
</a>
<a href="butterchicken.html">
<div class="max-w-sm rounded overflow-hidden shadow-lg justify-center">
<img class= "w-full" src="images/download (2).jpg" alt="Shahi Paneer">
<div class="px-6 py-8">
<div class="font-extrabold text-xl pb-3">Shahi Paneer</div>
<div>
<p class=" font-serif text-base mb-3">First Pick of Royales.</p>
</div>
</div>
</div>
</a>
</div>

Text is doesn't fill the whole div, only a portion in the middle

In short, my problem is this:
I'm using TailWind on Laravel, I can't get the text inside the border to fit the whole div he's in, and it's weirdly centered this way where the amount of characters per line is limited
I tried many approaches like changing and trying different values of padding and margin but I was unsuccessful, it only makes the div bigger but the text is still awfully centered and limited.
the code portion is as follows:
<div class="mx-4">
<x-card class="p-10">
<div
class="flex flex-col items-center justify-center text-center"
>
<img
class="w-48 mr-6 mb-6"
src="{{$album->logo? asset('storage/'.$album->logo) : asset('/images/noalbum.png')}}"
alt=""
/>
<h3 class="text-2xl mb-2">{{$album->title}}</h3>
<div class="text-xl font-bold mb-4">{{$album->artist}}</div>
<x-insidetags :tagscsv="$album->tags"/>
<div class=" w-full mb-6 mt-5">
<h3 class="text-3xl font-bold">
About the album
</h3>
</div>
<div>
<div class="flex">
<div class="px-20 text-lg border border-black text-left">
<h3 class="font-bold">Track List :</h3>
#foreach($tracks as $track)
<p>- {{$track}}</p>
#endforeach
</div>
<div class="text-lg space-y-6 ml-10">
<div class="text-left py-10">
{{$album->description}}
</div>
<a
href="{{$album->website}}"
target="_blank"
class=" bg-black text-laravel mt-16 py-2 px-10 rounded-xl hover:opacity-80"
><i class="fa-solid fa-globe"></i> Visit RateYourMusic page</a
>
</div>
</div>
</div>
</div>
For refrence I'm trying to create something like this, but only with the name of the tracks for the moment
I figured it out, added flex 1 1 0% and flex 4 1 0% to the two divs
<div class=" text-lg shadow-xl text-left flex-1 h-fit p-5">
<h3 class="font-bold">Track List :</h3>
#foreach($tracks as $track)
<p>- {{$track}}</p>
#endforeach
</div>
<div class="text-lg ml-10 flex-[4_1_0%]">
<div class="text-left py-10">
{{$album->description}}
</div>
<a
href="{{$album->website}}"
target="_blank"
class=" bg-black text-laravel mt-16 py-2 px-10 rounded-xl hover:opacity-80"
><i class="fa-solid fa-globe"></i> Visit RateYourMusic page</a
>
</div>

How to implement Tailwind grids with horizontal spacing without wrapping to the next line?

I have a section with the following contents:
<section class="flex flex-wrap -mx-2">
<Card
v-for="(course, index) in courses"
:key="index"
:title="course.title"
:professor="course.professor"
:price="course.price"
:excerpt="course.excerpt"
:image="course.image"
:category="course.category"
/>
</section>
A Card looks like this:
<article class="bg-red mt-5 px-2 w-full md:w-1/2 lg:w-1/3 xl:w-1/3 shadow-md rounded bg-white">
<nuxt-link to="/courses/example-course">
<img :src="`/images/${image}`" :alt="title" class="rounded-t w-full">
</nuxt-link>
<div class="p-4">
<header class="flex justify-between">
<section>
<h3 class="text-gray-700">
<nuxt-link to="/courses/example-course" class="hover:text-gray-600" v-text="title"></nuxt-link>
</h3>
<p class="text-gray-600 mt-1" v-text="professor"></p>
</section>
<div v-if="price">
<span class="px-2 py-1 bg-green-200 text-green-500 font-bold rounded">${{ price }}</span>
</div>
</header>
<article class="text-gray-700 mt-2" v-text="excerpt"></article>
</div>
<footer class="border-t border-gray-300 uppercase p-5 flex justify-between">
<span class="text-gray-600 text-xs font-bold self-center" v-text="category"></span>
<a href="#" class="text-gray-600 hover:text-blue-600">
<i v-if="price" class="fa fa-user"></i>
</a>
</footer>
</article>
And the outcome of all this looks like this:
As you can see, the cards are touching each other, despite me following what the Tailwind's docs say on grid spacing. I have tried adding ml-2 on the <article> tags, but that just results in wrapping the element prematurely and leaving out too much space.
What am I doing wrong here and how to add a gap between the cards? Thanks!
The "problem" with margin is that it lives on the outside of the box(model) of your element, e.g. it affects the total width of your card. For example on large screens you want them to be 33.33% wide, but if you add margin on the left/right, the card will have a width of 33.33% + margin which makes the flexbox container wrap after two items because otherwise the total width would be more than 100%. You can solve this by a) setting things to box-sizing: border-box (doesn't help with margin tough!) and b) use padding instead of margin to create the gaps, this usually requires some kind of wrapper around your content that does nothing else than dealing with spacing and sizing, something like this:
<article class="mt-5 px-2 w-full md:w-1/2 lg:w-1/3 xl:w-1/3">
<div class="card bg-red shadow-md rounded bg-white">
<nuxt-link to="/courses/example-course">
<img :src="`/images/${image}`" :alt="title" class="rounded-t w-full">
</nuxt-link>
<div class="p-4">
<header class="flex justify-between">
<section>
<h3 class="text-gray-700">
<nuxt-link to="/courses/example-course" class="hover:text-gray-600" v-text="title"></nuxt-link>
</h3>
<p class="text-gray-600 mt-1" v-text="professor"></p>
</section>
<div v-if="price">
<span class="px-2 py-1 bg-green-200 text-green-500 font-bold rounded">${{ price }}</span>
</div>
</header>
<article class="text-gray-700 mt-2" v-text="excerpt"></article>
</div>
<footer class="border-t border-gray-300 uppercase p-5 flex justify-between">
<span class="text-gray-600 text-xs font-bold self-center" v-text="category"></span>
<a href="#" class="text-gray-600 hover:text-blue-600">
<i v-if="price" class="fa fa-user"></i>
</a>
</footer>
</div>
</article>
I know it is kind of annoying to clutter up the markup like that, but its usually worth it =).
EDIT: It is actually as the docs say
Add a negative horizontal margin like -mx-2 to your column container and an equal horizontal padding like px-2 to each column to add gutters.
your issue is with the box-shadow that then doesn't let you create a visual gap, so technically you need the wrapper because of your box-shadow!