In some poems, often in theater-like writing, the end of an incomplete verse must be aligned to the begin of the continuing, like that:
The verse that is split is vertically aligned as if it weren't split.
I'm creating an ebook, and I need a trick to make the CSS consistent for any font, size, etc. (because they are tweakable) without relying on monospace.
Is this possible at all? I've thought about it, but I've had no idea, not even a lead.
For now, the HTML looks like that:
<div class="character">La Nourrice</div>
<p>Tu vis ! ou vois-je ici l’ombre d’une princesse ?
<br/>À mes lèvres tes doigts et leurs bagues et cesse
<br/>De marcher dans un âge ignoré...</p>
<div class="character">Hérodiade</div>
<p>Reculez.
<br/>Le blond torrent de mes cheveux immaculés
<br/>Quand il baigne mon corps solitaire le glace</p>
Within pre tag text will be displayed exactly as written by you
<div>
<pre style="font-family: sans-serif;">
La Nourrice
Tu vis ! ou vois-je ici l’ombre d’une princesse ?
À mes lèvres tes doigts et leurs bagues et cesse
De marcher dans un âge ignoré...
Hérodiade
Reculez.
Le blond torrent de mes cheveux immaculés
Quand il baigne mon corps solitaire le glace
</pre>
</div>
The only way I managed to do something similar is using direction: rtl; and a fixed width. In this case your main problem is that there's currently no way to force justify elements in CSS something that would be useful for this. Also, <br> tags break text-align: justify so in the case of the unfinished line I left the <br> but for the others I left it out. Even so, it looks a little weird.
There's a ::first-line CSS property, but unfortunately it can't use text-align.
There's also text-justify but it's not confirmed as a supported property yet, so it's not working. It could solve your problem if it becomes official though. You can check more on it on MDN Docs.
I'd suggest you revise your html structure if you can and have control over that part. Otherwise you don't have many options on this.
p {
max-width: 320px;
display: block;
text-align: justify;
direction: rtl;
}
<div class="character">La Nourrice</div>
<p>Tu vis ! ou vois-je ici l’ombre d’une princesse ?
<br/>À mes lèvres tes doigts et leurs bagues et cesse
<br/>De marcher dans un âge ignoré...</p>
<div class="character">Hérodiade</div>
<p>Reculez.<br> Le blond torrent de mes cheveux immaculés Quand il baigne mon corps solitaire le glace</p>
Related
I have a problem : on my website http://comportementaliste-du-chat.fr/, I want to create CTA's in my posts with Gutenberg. I found a great plugin to do that, but the thing is the design is good in the back office, but in the front office the default CSS overrides (the "!important" breaks my block in gutenberg so I can't use it) the gutenberg style. See example here https://comportementaliste-du-chat.fr/blog/15-plantes-toxiques-pour-votre-chat-avec-photos/
If someone could help me, it would be great :) thanks a lot !!
Front office result //
Back office result
<div class="wp-block-media-text__content">
<h2 class="has-text-color" id="et-si-on-prenait-un-moment-pour-discuter-de-ce-qui-vous-tracasse" style="color:#ffffff">Et si on prenait un moment pour discuter de ce qui vous tracasse ?</h2>
<p class="has-text-color" style="color:#d7d7d7">Si vous êtes en train de lire cet article, c'est que <strong>quelque chose vous chiffonne, ou vous intrigue</strong>. Savez-vous que les consultations sont là pour <strong>résoudre un problème, mais aussi le prévenir</strong> ? Je peux vous aider à anticiper un événement ou à <strong>solutionner un comportement indésirable</strong>. Alors n'hésitez-pas, <strong>venez m'en parler !</strong></p>
<div class="wp-container-1 wp-block-buttons">
<div class="wp-block-button"><a class="wp-block-button__link has-white-color has-text-color has-background" style="background-color:#54bcfb">Discutons ensemble !</a></div>
</div>
I'm new to react and next.js
I'm trying to do a projetct with next.js
I have a global css with a .container style properties and I imported it in my _app.js file.
But I don't know how to import it in a page.
I have a page with a import module.css and I understood that but in this page there is a div with the global container class and I don't know how to pass the css property.
Is it possible to write .container property in the global css or does it just work with global tags like a, img, h1, etc ?
I'm a little lost with the css in Next.
I think I've worked out how to pass global css to a page whitch contain module.css but know I'm stuck with the module css.
I've created a compotent HeroSection like that :
import React from "react";
import style from "./heroSection.module.css";
function HeroSection({ title, paragraphs, image }) {
return (
<div className={style.heroSection}>
<div className={style.text}>
<h1>{title}</h1>
<div className={style.paragraphes}>{paragraphs}</div>
</div>
<img src={image} alt="" />
</div>
);
}
export default HeroSection;
And a page whith contains the component and adds props :
<HeroSection
title="Nous contacter"
paragraphs={
<>
<div className="para1">
<p> Améliorons ensemble ce projet de société !</p>
<p>
Nous sommes à l’écoute de tes suggestions, avis et
commentaires.
</p>
</div>
<p>
C’est juste ici
</p>
</>
}
image="/images/contact.jpg"
/>
In my heroSection.module.css I have this code :
.para1 {
margin-bottom: 44px;
}
As you see in the page containing the heroSection a div has the className "para1" but I am unable to apply the css on it.
I tried className={style.para1} without success.
How can I style the div passed as props ?
You need to import to CSS file in the page where you use the <HeroSection> component.
import style from "<relative-path-to-heroSection.module.css>";
Then pass the appropriate class to the <div> further down.
<HeroSection
title="Nous contacter"
paragraphs={
<>
<div className={style.para1}>
<p> Améliorons ensemble ce projet de société !</p>
<p>
Nous sommes à l’écoute de tes suggestions, avis et
commentaires.
</p>
</div>
<p>C’est juste ici</p>
</>
}
image="/images/contact.jpg"
/>
i'm trying to pass an array of string in pth url, how can i put the for in teh path
i try to make a button on a twig in a app symfony
<a href="{{ path('cheops_glpi_tracking_search', {'status[]':{% for statu in status %} statu {% endfor %},'cheops_Glpi':1,'fkEntities_cheops_Glpi':tracking.fkEntities.id}) }}" target="_blank" class="btn" style="border:none;border-radius:75%;
border-bottom:3px solid #f03c0c;font:bold 13px Arial;color:#56504e;background:#fff;">
Voir tickets
</a>
Message : A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "operator" of value "%".
Une erreur s'est produite sur l'intranet ou vous n'avez pas accès à cette partie. Nous avons été automatiquement prévenu de cette erreur et allons régler le problème dans les plus brefs délais.
I'm not sure you can inline a for loop that way.
Instead you could join the elements the following way
Voir tickets
I have two patterns in html page the only difference between them is an existance of aditional text after the closed strong tag. Here is an example:
Sample 1 (with additional text after the tag strong):
<p><strong>14h45 De violents combats ont lieu à Zawiyah</strong>, à 40km à l'Ouest de Tripoli entre les insurgés et les forces restées fidèles au colonel Kadhafi. Un témoin oculaire, cité par l'agence de presse italienne Ansa, affirme: "C'est un massacre, il est difficile d'estimer le nombre de morts". Il y aurait une centaine de victimes, selon la BBC. </p>
Sample 2 (without additional text):
<p><strong>Quitte à revenir dans l'euro quelques années plus tard?</strong> </p>
I need two XPath so I can get text inside tags '<strong>...</strong>' for both cases.
Right now I m using
'//p//strong//text()[normalize-space()]'
but it captures text from both samples while I need two separate XPaths.
Any help is appreciated.
UPD
Also is there a way to handle cases when
<p>
<a href="http://www.slate.com/id/2286172/" target="_blank">
<strong>Combien coûte un mercenaire?</strong>
</a>
Alors que le régime de Kadhafi semble avoir recours à des combattants étrangers pour réprimer les insurgés, Slate se penche sur leur fonctionnement... et leur émoluement (en anglais).
</p>
The XPath
"//p//strong[not(following-sibling::text()[normalize-space()])]//text()"
will return:
Combien coûte un mercenaire?
However there is a text after the tag
You can use following-sibling::text()[normalize-space()] in predicate for strong to get only strong elements that is followed by non-empty text nodes :
//p/strong[following-sibling::text()[normalize-space()]]/text()
and use the opposite predicate not(following-sibling::text()[normalize-space()]) to get the rest of the strong elements :
//p/strong[not(following-sibling::text()[normalize-space()])]/text()
Notes: the above will work assuming that is considered a white-space in the XPath library that you're using. Otherwise, you might need to compare the length of the text node following the strong element with the length of the text , to determine if the text node is more than just a white space ( ), something like :
following-sibling::text()[string-length(normalize-space())>string-length(' ')]
I have html with the next structure (see below) and need to get all texts between <p></p> and <h3></h3> or <h2></h2> which are on the same level in html structure.
Here is an example:
<p>..</p>
<p>..</p>
..
<p>"<em>Ce que nous voulons souligner, c'est que la Tunisie est sur la bonne voie</em>", a déclaré Mona Richmaoui, membre de la mission. </p>
<h3 class="intertitre title_delta">SANCTIONNER LES VIOLATIONS DES DROITS DE L'HOMME</h3>
<p>Le ministère tunisien de l'Intérieur a engagé lundi une procédure visant à la dissolution... </p>
..
<p>..</p>
<div>...some text over there ....</div>
..
<h2>some text</h2>
..
<p>..</p>
The output should be:
"Ce que nous voulons souligner, c'est que la Tunisie est sur la bonne voie", a déclaré Mona Richmaoui, membre de la mission.
SANCTIONNER LES VIOLATIONS DES DROITS DE L'HOMME
Le ministère tunisien de l'Intérieur a engagé lundi une procédure visant à la dissolution...
..
some text
I m using the next XPath but it ignores text between <h3></h3> tags:
//p//text()[normalize-space()]
If you are trying to get the text of all the elements:
//*//text()
If you want to specify elements:
//p//text()|//h3//text()|div//text()