Unwanted breakline behavior - general explanation - html

I have experienced cross-browser problem that a line on a page in a narrow column is breaked too early despite the space left where the last word could easily fit.
Firstly I thought there is something wrong with my stylesheet but it looks the same in a simple fiddle which I created (no php tags, no line-breakers, etc.):
I am sorry as it's in Czech Language but for demo purpose I hope it's ok.
It shows the same bug in FF,IE and Chrome on Win7 and Win8, even on iPad.
Link to fiddle: http://jsfiddle.net/Grows/q9wqeu14/1/
Demo:
HTML:
<div class="column">
<p>Jsme tým zkušených profesionálů, který Vám pomůže s kompletním IT řešením. Spravujeme IT techniku jak menším firmám do deseti uživatelů, tak i velkým společnostem se stovkami stanic a desítkami serveů. Náklady na externí správu sítě jsou zcela individuální a závisí na rozsahu sítě (počet serverů, stanic, aktivních prvků apod.), dohodnuté frekvenci návštěv a garantované době servisních zásahů. U menších firem se tato částka obvykle pohybuje v jednotkách tisíců korun měsíčně, takže se určitě vyplatí více, než zaměstnávat vlastního správce sítě.</p>
</div>
<div class="column">
<ul>
<li>Individuální přístup a vstřícnou péči o uživatele výpočetní techniky</li>
<li>Pravidelnou údržbu výpočetní techniky - minimalizují se její výpadky</li>
<li>Garanci servisního zásahu - minimalizuje ztráty způsobené výpadkem</li>
<li>Řízení IT procesů - provozujeme systém HELPDESK pro hlášení servisních požadavků, telefonickou linku HOT-LINE a automatický monitorovací systém NAGIOS, který nepřetržitě monitoruje chod Vašich klíčových zařízení</li>
<li>Poradenství a konzultační služby</li>
</ul>
</div>
<div class="column">
<ul>
<li>Finanční úspora - IT specialistu využíváte jen tehdy, je-li to potřeba. Ušetříte na mzdových nákladech, odborných školeních apod.</li>
<li>Flexibilita - služba je smluvně garantovaná, nemusíte řešit nemoci, dovolené, zástupy apod.</li>
<li>Profesionalita - pracujeme v týmu, máme zkušenosti, kvalitní technické zázemí a podporu našich dodavatelů. Jsme schopni minimalizovat rizika výpadku sítě či je zkrátit na minimum.</li>
<li>Přenesení zodpovědnosti za bezproblémový chod Vaší sítě na dodavatele</li>
</ul>
</div>
CSS:
body {
font-size: 14px; font-family: 'Arial'; text-align: left;
}
.column {
width: 214px; border: 1px black solid;
}
li {
list-style-type: disc; list-style-position: outside;
}
What me and both my client see is the weird break between 3rd and 4th row but also in more text.
I tried to search similar questions here and Google it but no success.
Is this a standard browser behavior or there is something wrong?
I really don't want to use manual line-breakers like br, wbr, nbsp, etc.
Thanks a lot!
Cheers, Martin
---- UPDATED ----
Thanks for the given solutions guys so far.
There are no white-spaces of any kind it's just pure text, so I can't remove any.
Also it must stay in three divs.
I guess it's some weird behavior of czech language in browser but I didn't see something like this before.
Maybe I can't do anything with it and this could be an answer too :)
---- SOLVED ---
Emmanuel was right.
There was something weird with some space characters. When I deleted them and typed space again, it dissapeared. Thank you so much! If someone explain this to me I would be very happy because in the source-code there weren't any visible "white-space" like tags...

See Remove non breaking space from <h4>. In your editor, search for non-breaking spaces if you know how to do that, turn on a mode which displays them, or do a search-and-replace of non-breaking spaces with regular old sp0aces.

Remove second and third div like this:
<div class="column">
<p>Jsme tým zkušených profesionálů, který Vám pomůže s kompletním IT řešením. Spravujeme IT techniku jak menším firmám do deseti uživatelů, tak i velkým společnostem se stovkami stanic a desítkami serveů. Náklady na externí správu sítě jsou zcela individuální a závisí na rozsahu sítě (počet serverů, stanic, aktivních prvků apod.), dohodnuté frekvenci návštěv a garantované době servisních zásahů. U menších firem se tato částka obvykle pohybuje v jednotkách tisíců korun měsíčně, takže se určitě vyplatí více, než zaměstnávat vlastního správce sítě.</p>
<ul>
<li>Individuální přístup a vstřícnou péči o uživatele výpočetní techniky</li>
<li>Pravidelnou údržbu výpočetní techniky - minimalizují se její výpadky</li>
<li>Garanci servisního zásahu - minimalizuje ztráty způsobené výpadkem</li>
<li>Řízení IT procesů - provozujeme systém HELPDESK pro hlášení servisních požadavků, telefonickou linku HOT-LINE a automatický monitorovací systém NAGIOS, který nepřetržitě monitoruje chod Vašich klíčových zařízení</li>
<li>Poradenství a konzultační služby</li>
</ul>
<ul>
<li>Finanční úspora - IT specialistu využíváte jen tehdy, je-li to potřeba. Ušetříte na mzdových nákladech, odborných školeních apod.</li>
<li>Flexibilita - služba je smluvně garantovaná, nemusíte řešit nemoci, dovolené, zástupy apod.</li>
<li>Profesionalita - pracujeme v týmu, máme zkušenosti, kvalitní technické zázemí a podporu našich dodavatelů. Jsme schopni minimalizovat rizika výpadku sítě či je zkrátit na minimum.</li>
<li>Přenesení zodpovědnosti za bezproblémový chod Vaší sítě na dodavatele</li>
</ul>
</div>

You just need word-break: break-all; style to column. WORKING CODE

If you look specifically at:
řešením. Spravujeme
in a HEX editor, the "space" between the '.' and 'S' is actually 2 bytes:
C2 A0
C2A0 is a non-breaking space in UTF-8 HEX and a "normal" breaking space is HEX 20.
Since this is a non-breaking space, the browser doesn't consider it a valid point to break the word to line-wrap.

Related

Laravel: How to change div font

I am displaying a greeting to the user on my dashboard page, how can I change the first 2 words (the div) to be a larger, maybe even a different font? Can I add a space margin underneath too, to separate the greeting from the rest? (This is me trying to learn Laravel) Thank you :)
So far I've tried:
<div>
#isset($user)
<style type="text/css">
#font-face {
font-family: Muli-Bold;
src: url('{{ public_path('fonts/materialdesignicons-webfont.ttf') }}');
} // I guess I need an #endfont-face here, but for some reason my ide wasn't recognizing it
</style>
Hallo {{ $user->name }},
#endisset
</div>
<div>Willkommen im <b class="text-gray-700">Formular-Editor!</b></div>
<div>Neue Formulare kannst du über den Tab <i><b class="text-gray-700">"Editor"</b></i> oben in der Leiste anlegen. Hier kannst Du auch bestehende Formulare bearbeiten.</div>
(I've also tried putting "hello user" into the style component/tag)
also like this:
<div font-size="3">
Hallo {{ $user->name }}
</div>
But they haven't worked. What's the best way to make it work without insalling trailhead?
Move your #isset($user) to wrap the <div> element and apply your styles on the <div>. There is no point performing #isset($user) inside the <div> as all that will do is render a redundant empty element.
#isset($user)
<div style="font-family: Muli-Bold; font-weight: bold; text-decoration: underline; padding-bottom: 10px;">
Hallo {{ $user->name }},
</div>
#endisset
You can apply any other css styles you want in the same manner, however, it would be better to define one or more classes which encapsulate the required styling and then apply the class to your elements.

How to display text with spaces in HTML

here I have an example. how can I display this text on my html page as is?
I tried using &nbsp for spaces and br for lines, br seemed to work but &nbsp did not.
-`
.o+`
`ooo/
`+oooo:
`+oooooo:
-+oooooo+:
`/:-:++oooo+:
`/++++/+++++++:
`/++++++++++++++:
`/+++ooooooooooooo/`
./ooosssso++osssssso+`
.oossssso-````/ossssss+`
-osssssso. :ssssssso.
:osssssss/ osssso+++.
/ossssssss/ +ssssooo/-
`/ossssso+/:- -:/+osssso+-
`+sso+:-` `.-/+oso:
`++:. `-/+/
.` `
Here is Code snippet to check how it's rendered
<p>
-`
.o+`
`ooo/
`+oooo:
`+oooooo:
-+oooooo+:
`/:-:++oooo+:
`/++++/+++++++:
`/++++++++++++++:
`/+++ooooooooooooo/`
./ooosssso++osssssso+`
.oossssso-````/ossssss+`
-osssssso. :ssssssso.
:osssssss/ osssso+++.
/ossssssss/ +ssssooo/-
`/ossssso+/:- -:/+osssso+-
`+sso+:-` `.-/+oso:
`++:. `-/+/
.` `
</p>
Use the preformatted text element: <pre>—it renders text and whitespace exactly as written, using a monospaced font.
<pre>
-`
.o+`
`ooo/
`+oooo:
`+oooooo:
-+oooooo+:
`/:-:++oooo+:
`/++++/+++++++:
`/++++++++++++++:
`/+++ooooooooooooo/`
./ooosssso++osssssso+`
.oossssso-````/ossssss+`
-osssssso. :ssssssso.
:osssssss/ osssso+++.
/ossssssss/ +ssssooo/-
`/ossssso+/:- -:/+osssso+-
`+sso+:-` `.-/+oso:
`++:. `-/+/
.` `
</pre>
To make it more accessible for people using screen readers and other assistive technology, you could add an image ARIA role to the <pre> element and provide alternative text, like so:
<pre role="img" aria-label="ASCII art of an upward-sweeping, triangular arrow.">

inline div is not in center of another div/section on server but on localhost its fine

Here is the website and the part where im having issues
https://kas-test.000webhostapp.com/volonteri.html
Top part where i used inline tag works but its not in center like the bottom part, also on kontakt.html.. everything is off its course while when i run the same code on localhost everything looks fine..
Here is picture of localhost:
Its perfectly in center.. why?
I DO recommend to you start using a grid system (bootstrap has a good one). Also blockquote isn't a good way to make a "left border", you can accomplish it by using border-left: 5px solid black
But if you only want to "hotfix" your code, you can update it by doing:
.inline {
display: inline-block;
width: calc(50% - 30px); // new
max-width: 500px; // new
margin: 15px;
float: left;
}
blockquote {
text-align: justify;
border-left: 5px solid black;
border-radius: 3px;
padding-left: 20px; // new
}
Cheers,
Try this instead:
<blockquote>
<div style="padding-left:30px;">
‘‘Sveukupni rad i funkcioniranje udruge bazira se na radu volontera. Volonteri su jedna od najvažnijih i nezaobilaznih karika u cjelokupnom programu rada udruge. Minimalna dobna granica volontera za uključivanje u rad udruge je 14.godina. Nakon što izrazi želju da želi volontirati, volonter ispunjava pristupnicu te nakon toga potpisuje volonterski ugovor gdje su regulirana prava i obaveze volontera, te dobiva volontersku knjižicu u koju se svake godine upisuju odrađeni sati volontiranja. Volonteri su dužni držati se svim pravila i propisa o ponašanju što je definirano u volonterskom ugovoru. Volontirati se može na više različitih načina a najčešći su uključivanje u provedbi terapijskog jahanja, pomoć oko skrbi za konje, pomoć kod održavanja rekreacijskog jahanja, pomoć pri čišćenju i održavanju okoliša i opreme, sudjelovanje na raznim kulturno-zabavnim manifestacijama na kojima udruga sudjeluje, pomoć oko promidžbe rada udruge, konjičkog sporta, reklamiranja, upoznavanja građanstva s aktivnostima udruge itd. Ovisno o potrebama i mogućnostima organiziraju se radionice za volontera gdje se obučavaju i osposobljavaju za što efikasniji rad. Više puta kroz godinu organizira se druženje volontera a u skladu s mogućnostima i edukacija i usavršavanje izvan udruge.”
<h6><i>Dominik Tomaš</i></h6>
</div>
Try to adjust the padding-left value to recenter it properly, since you're using border-left for the <blockquote> at the same time you had your text inside it, that's why it keeps the text sticking on the border, what i did is I tried to put the texts in a different element, but still in the inside the div. Check this if it helps you.

Don't allow <sup> to break line

How to restrict for <sup> to go to the next line? Or at least somehow also show the previous word in the new line? I have an achor tags which links to a reference at the bottom of an article, but sometimes they will just go into next lines by itself, as you can see in the image. This can happen if there is a single <sup> too.
Currently I have this for css
left: -3px;
top: -0.5em;
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
And this is html code for a single <sup>
<a class="footnote" title="V. Umeljić, (2004.), U svijetu cvijeća i pčela: Atlas medonosnog bilja, Zagreb: Tisak" id="return-note-4832-1" href="#note-4832-1"><sup>[1]</sup></a>
safasdfasdfasdfsd asdf sdaf asdf asdfsadf sa fdas fg dfg sddfg sdfgsfgg sfg sdfg sdfgsdfg<a class="simple-footnote" title="V. Gligić, (1954.), Etimološki botanički rečnik, Tuzla: Grafičar" id="return-note-5174-4" href="#note-5174-4"><sup>[1]</sup></a>
<a
class="simple-footnote" title="V. Gligić, (1954.), Etimološki botanički rečnik, Tuzla: Grafičar" id="return-note-5174-4" href="#note-5174-4"><sup>[2]</sup>
</a>
Working JSFiddle
Just replace your inline elements' spaces with like this:
<a class="footnote" title="V. Umeljić, (2004.), U svijetu cvijeća i pčela: Atlas medonosnog bilja, Zagreb: Tisak" id="return-note-4832-1" href="#note-4832-1"><sup>[1]</sup></a> <a class="footnote" title="V. Umeljić, (2004.), U svijetu cvijeća i pčela: Atlas medonosnog bilja, Zagreb: Tisak" id="return-note-4832-1" href="#note-4832-1"><sup>[2]</sup></a>
The looks like a space to a person, but the browser treats the last word in your paragraph and the links as a single string.

CSS place elemtent at position of another (NOT parent)

I have an XML file which consists mostly of text. However, there are some element in there containing additional information. Let's call these additional information bits "element". In some paragraphs there is none of these, in some paragraph several. Sometimes there are even right after each other. However, in different paragraphs they are always at different positions.
Here's mock up:
<paragraph>
Qui <element>20</element> corti. num sit <element>10</element><element>5</element> igitu pugis quium. quem er Epiendis nessictilluptiudicaribus? qui ipsarent scit verspitomnesse con eiudicitinec tam ret pari Graeperi diurum eo <element>50</element> nebituratam num aerminxeato nilibus. nostereffer est modulceribus, ficantendus anonea Chraectatur, quemodumquae ut pet sum re vivatotertentu vitra cortem nonemod hunturunclia dolum poraectiatiamas rein eximplatorefut egra vartere
</paragraph>
Now I want to transform this XML file into HTML with XSLT. The problem is: The "additonal elements" should appear nowhere in the text, but at a separate column. Like this:
As you can see, the numbers (bearing my "additional information") appear right at the level where they are in the text: "20", "10" and "5" are at the first line, because in the XML source data they are are referenced after the words "Qui" and "sit", which are in the output both at the first line in the text. "50" is right at the level of "eo" nebituram".
How can I achieve this behaviour with CSS?
It is rather easy to put an anchor element in the HTML at this very same position:
eo <a id="some_id"/> nebituratam
Let's say that the "50" is in a span-element
<span stlye="...">50</span>
However, what do I put in the CSS here? Is there a way to state in CSS to place this span right at the level of the anchor with the id "some_id"?
Of course, the anchor can in no way be the parent of the span element.
Honestly, I'm quite sure that my problem is unsolvable without JavaScript or something, but I'd like to avoid skripts wherever I could.
Try This
p{
padding-left:50px;
position:relative;
}
p span{
position:absolute;
left:10px;
top:45%;
font-size:16px;
font-weight:bold;
}
<p>Qui corti. num sit igitu pugis quium. quem er Epiendis nessictilluptiudicaribus? qui ipsarent scit verspitomnesse
con eiudicitinec tam ret pari Graeperi diurum eo <span>50</span> nebituratam num aerminxeato nilibus. nostereffer est modulceribus,
ficantendus anonea Chraectatur, quemodumquae ut pet sum re vivatotertentu vitra cortem nonemod hunturunclia dolum
poraectiatiamas rein eximplatorefut egra vartere</p>