TailwindCSS's whitespace-pre-line is not working? - html

whitespace-pre-line seems not working for me. I've tried to copy the same code from my text editor to https://play.tailwindcss.com/ , it works like a charm. I've attached the screenshot below.
sample code in my text editor:
export default function App() {
return (
<div>
<p className="whitespace-pre-line">
Just for
demonstration
purpose
</p>
</div>
);
}
the result shows here:
sample code in play.tailwindcss.com
<div>
<p class="whitespace-pre-line">
Just for
demonstration
purpose
</p>
</div>
the result shows here:

As far as the whitespace-pre-line is concerned. The second ouput is actually the desired output.
I guess it's technical issue or your code in the https://play.tailwindcss.com/ was wrapped with some other parent classes.
For me it worked perfectly.
Just for clarity .
According to the documentation of the tailwind.
Use whitespace-pre-line to preserve newlines but not spaces within an element. Text will be wrapped normally.
For example the code:
<div class="w-3/4 ...">
<div class="whitespace-pre-line ...">Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.</div>
</div>
And the ouput goes like:
Hey everyone!
It's almost 2022 and we still don't know if there is aliens living among us, or do we? Maybe the person writing this is an alien.
You will never know.
For more details please follow the tailwind documentation. https://tailwindcss.com/docs/whitespace

Just add the class whitespace-pre-line to the div.
<div class="whitespace-pre-line">
<p>
Just for
demonstration
purpose
</p>
</div>

Related

How to add this effect

I'm trying to build a personal website from scratch. While I was looking around for ideas, I found this particular template that I liked: http://phydeve.epizy.com/imozar/index-1.html
I want to try building everything on my own to learn but there's one thing I can't figure out. How do I achieve the changing text under the header (under "Hi I'm Norman Doe"). I've tried multiple google searches with differing terms but I can't find an explanation.
I am fine learning any language/flavor I might need.
I believe that person is using a plugin called Typer.js
Link: https://steven.codes/typerjs/
There are definitely a lot of ways to do it with JS, but if you want minimal coding, I'd use a plugin.
<!--Put your words in the DATA-WORDS-->
<h1 style="font-family:sans-serif;">
we are <span
class="typer"
id="some-id"
data-words="sample word,another sample,amaziing"
data-colors="#ed426d,#6d67c6,#b74033"
data-delay="50"
data-loop="1">
</span>
</h1>
<!--Insert at the bottom of your html file-->
<script async src="https://unpkg.com/typer-dot-js#0.1.0/typer.js"></script>
Here's a fiddle:
https://jsfiddle.net/jemismagical/1ajz9etk/19/

Angular material checkbox vertical line

I'm having an issue with Angular Material checkbox where after rendering there is an additional vertical line that is added because a class in the material.
This is my HTML:
<div class="col-md-6 col-sm-12">
<div class="col-sm-12">
<mat-checkbox class="full-width" formControlName="TPA_NUSC">{{ 'GLOBAL.TAX_NUMBER_MANDATORY_AB' | translate}}</mat-checkbox>
</div>
<div class="col-sm-12">
<mat-checkbox class="full-width" formControlName="TPA_VLNC">{{ 'GLOBAL.VALIDATE_TAX_NUMBER_AB' | translate}}</mat-checkbox>
</div>
</div>
And this is my output:
That verical line comes from the class "mat-checkbox" that is added after the rendering, at least, if I remove the class the line will disappear.
Any tips about this issue?
I had a similar problem but realized that I didn't have a theme.
Make sure you have something like this in styles.css: #import "~#angular/material/prebuilt-themes/indigo-pink.css";
I have found the issue, seems that someone add a class in our company css that override that indigo-pink.css
Many thanks to #Peter Kim to allow me to find the issue.
If anyone will have an issue like this, there is how I found out what could be wrong.
Try to get the cloested element in your developer console
Doing that I found out that the class had an border-right.
Click in the right top corner to go to the css file that is causing the issue
It will redirrect you to the css file, however it may not tell you which file it's, but you can go to your index.ts or where you declared your css and count the css until you get a match, for example, in my case it was the 14th sheet.
Just go to that sheet and search for the issue, in my case I searched for #b7b7b7 and it was a direct match.
Hope it help some else.

What is wrong with my positioning? (jsfiddle included)

This is what I want VS what I have:
https://jsfiddle.net/fs0vydgd/
<div class="left-align">
<div class="songListContainer">
<div id="outerBoundingBox">
<img src="https://s-media-cache-ak0.pinimg.com/736x/ec/8d/bc/ec8dbcafb4aad7d54bbae197867c6c7c.jpg" class="albumArt" />
<div class="songTitle">Artist - Song name here</div>
<div class="songDetails">Year: 2002 Genre: Punk Album: Title</div>
</`div`></`div`></`div`>
I am trying to recreate an old website I worked on ages ago. I still have a screenshot of the layout which you can see. The album art image displays perfectly fine, but the lines of text with the song description don't line up appropriately. Even manually assigning margins has proven unsuccesful. My guess is that I have a problem with my parent/child setup in the way I am using display:inline-block, but I have tried multiple combinations to no success.
This is a difficuilt question to ask and better illustrated in the screenshot and JSfiddle provided.
Thanks for any help, I have not been able to find information regarding this specific case.
Start with adding float: left to .albumArt, I think you might already get a lot closer to your desired result.
Fiddle

selecting deep elements in d3

So for my question you can refer to udacity.com main page.
Im trying to access this text -"The Udacity Difference" somewhere on the middle of the page.
I tried this :
d3.select("div.banner-content.h2.h-slim")
d3.select("div.banner-content.h-slim")
None of the above is working. So I tried looking in dev-tools element section for this page.
Then I could hover and see that :
div.banner-content has further
{div.container
{div.row
{div.col-xs-12 text-center
{h2.h-slim}}}}
Then I thought ok I shoud try if I can get the "container" atleast, but then even this
d3.select("div.banner-content.div.container")
OR
d3.select("div.banner-content.container")
doesnt work !!!!
Wheres the fault in logic ?
You can find nested elements using d3's chained syntax as shown below.
HTML:
<div class="banner-content">
<div class="container">
<h2 class="h-slim">Header</h2>
</div>
</div>
Code:
d3.select("div.banner-content").select("div.container").select("h2.h-slim")
EDIT: No need to type such long syntax. Just need to separate the selectors using a space.
d3.select("div.banner-content div.container h2.h-slim")
Code below will also give you the same results in this case. You can specifically add tags if necessary.
d3.select("div.banner-content .container .h-slim")

CSS p {Indent} Leaving a gap

I am trying to make a website that has a contents page.
I use the go to chapter 1 as the contents part,
and when it clicks it does to the <a name="chapter1"><u>Chapter 1</u></a>
This works well, but there's 1 catch (there's always a catch)...
I want to make it look like the ones on Wikipedia:
[View Image][1]
[1]: http://crystalanalysis.anydns.com/images/wikipedia_contents.png
But I didn't want to copy the one from Wikipedia, I wanted to make my own,
I looked around, found the parts I needed and had 2 problems! The first problem I am
having has something to do with the Indent. I tried using the p.indent {text-indent:150px}
but it only did the indent for the line I put it before. So:
Indented text
But it was annoying having to put the Indented text before every single line in the
contents box, but it works:
<header>
p.contenttitle {text-indent:50px;}
p.contentsub {text-indent:100px;}
</header>
<body>
<div style="background-color:#FFFFFF;width:1024;border:solid 1px #000000;"><br>
<font class=Blackverdana><b>Contents:</b><br></font>
<div align="left">
<!-- CONTENTS a href --><font class=Blackverdana>
<p class=contenttitle>Chapter 00: First things first...
<p class=contentsub>Chapter 0.2 Finding the SDK for your game
<p class=contentsub>Chapter 0.3 Running the Hammer Editor
<p class=contentsub>Chapter 0.4 First Load<br><br>
</body>
The other problem I am having is that if you look at the contents page:
http://crystalanalysis.anydns.com/7-12-2013.html
you will see that there seems to be some sort of <br> after every line.
I did not plan to have those there, they just appeared. Maybe a connotation with the "p" tag?
Any help would be greatly appreciated
And also the website is a blog and I am making a Hammer Editor Tutorial if anyone was wondering.
So it seems that you aren't ending the tags when you first start them.. An example of this:
<p class=contenttitle>Chapter 00: First things first...
When in all reality it should be:
<p class=contenttitle>Chapter 00: First things first...</p>
That could be a possible issue, as well as you should really look into using a CSS page to reference your HTML. Creating a class/id will actually make that indentation process ten times easier. For more information on that I can provide a handy link from w3.org that can explain the entire process of using CSS and how it can make your life a lot easier!
http://www.w3.org/Style/Examples/011/firstcss.en.html