WordPress Word Wrap and Line Break Problem - css

I am using WordPress 4.9.10 and same theme for 2 different sites. However, one site is having line-break and word-wrap problems.
It keeps wrapping a line in random position. It mostly breaks a new line at hyphen(-), but not ALL hyphen will create a line break.
The same line break problem will happen in both editor (WPBakery) and web page.
I wondered if this is caused by CSS word-wrap. I have forced <body> <p> <div> as word-wrap: normal !important, but same problem still persists.
Here is a sample of the displayed text:
Curabitur neque lorem, congue in urna sed, porta lobortis leo. Morbi
hendrerit viverra nibh. Cras ac malesuada-
diam. Nullam in purus
consequat, ultricies quam quis, imperdiet tortor. Aliquam justo sem,
elementum et elit congue, molestieullamcorper lacus. Phasellus
malesuada tincidunt-
leo. Morbi mauris-lorem, dapibus vitae tellus ut,
interdum gravida massa.
Vivamus pharetra tincidunt ex, et
porttitor tellus luctus at. Fusce et hendrerit dolor, a tempor eros. Vestibulum nec ante enim.
I cannot see the pattern of how it breaks the line. Not all hyphens cause new lines.
Would this be caused by CSS or Wordpress?
Thank you very much in advance.

I fixed the problem by upgrading WPBakery plugin.
Then, created a new post and copied the source code from the original post.
Problem fixed instantly by copying the HTML source code. Maybe the old WPBakery backend mode had messed up the source, and the new WPBakery had fixed some tags while copying the source text over.
Seems that there is nothing to do with CSS.

Related

Chrome adding extra spaces in between words?

Using wordpress.org, only happening in Chrome.
Aenean lacinia bibendum nulla sed consectetur. - in backend of WP...
Renders this...
Aenean lacinia bibendum nulla sed consectetur.
There aren't additional or padding, etc. Just one space that is at least double wide. Seems to fix when I delete the space (so there is none), then space again in the areas that are being affected.
Please help!!
Looks like the text formatting is set to 'justifyfull'. In the post editor just select the text then change is justification to 'left'.

Missing anchor tag in wordpress post

Is there a way to display the anchor or link in a post using the_excerpt. In the wordpress editor i have a placed an anchor tag in the beginning of the post. It works correctly when i view the full article. But it does not work when using excerpt.
Here is an image of the post. I even highlighted the word
http://i255.photobucket.com/albums/hh140/testament1234/anchortag_zpsf77fbef2.jpg
And here is the code when i checked the view source. As you can see the link facebook.com turns into a paragraph instead of an anchor link.
<div class="content">
<!--TEXT -->
<p>www.facebook.com Nullam dictum eleifend neque facilisis pellentesque. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur cursus mollis tincidunt. Donec tincidunt, augue ullamcorper pharetra porta, metus turpis volutpat urna, nec [...]</p>
<a class="readmore" href="http://localhost/wordpress/sample-post-14/"><span>Full Article</span></a>
</div>
How can i solve this? If i replaced the_excerpt with the_content it will display the contents of that post.
The problem is that by default the_excerpt function disable all the HTML tags. That's why all the links disappears.
You will may be need to custom the content returned by the_excerpt function and allow the link tags for example. This tutorial show you how to do this.
echo $post->post_excerpt; // this will return you the excerpt of the current post

Conflict between PIE and JQueryUI's accordion

I'm using PIE to achieve some cross-browser CSS3 effects (gradient backgrounds, rounded corners, drop shadows, etc), but it's messing up my jquery accordion something awful.
Basically when PIE inserts its css3-container elements into the DOM, the jquery accordion code can't recover, because it's expecting the accordion container to be filled exclusively with an alternating list of H3 and DIV elements.
Has anyone found a way to make these two tools play nice together?
Instead of CSS PIE use pie.js the simple benifit that pie.js gives you is that you decide when to apply pie classes you can find a nice documentation on how to use pie.js here . Simply by the javascript way the pie will be applied after the code is executed by jQuery hence it should NOT mess with the markup. [though i am going to test it ]
And your code with pie should look something like
$('.accordion').accordion({
parameter:value;
});
$('.pieElement').each(function(){
PIE.attach(this);
});
Another method of doing this is by using gutters , while programming mobile webapps because of webkit i found out how useful gutters can be especially with polyfills .
Using gutters your code can look like
<div id="accordion">
<h3><span class="gutter">Section 2</span></h3>
<div>
<div class="gutter">
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
</div>
</div>
then apply your PIE CSS3 on gutters , from what i have read about PIE it seems that it applies a VML markup inside the parent of the element and if so using gutters the style will be applied without changing your markup.

How can I change fonts in a beamer presentation that uses Sweave?

When I include \usepackage{Sweave} in the preamble of a beamer presentation, beamer ignores changes to font, e.g., \usepackage{helvet}.
Here is a minimal example:
\documentclass[professionalfonts]{beamer}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage{Sweave}
\begin{document}
\begin{frame}
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{frame}
\end{document}
The text is set in computer modern, rather than helvetica. If you comment out \usepackage{Sweave}, then the text is set in helvetica.
Thus my question: Is there a way to change fonts in beamer presentations that include Sweave content?
I realize that my example here does not include any actual, "Sweable" R code, but it seems to not matter, because the unwanted font-switching behavior appears to result from Sweave.sty. My bigger goal is to use pgfSweave with beamer, but I'm having the same problem there. I think I have tracked it down to \usepackage{Sweave}.
From the R-help mailing list, Roger Peng suggests
\usepackage[noae]{Sweave}
See http://tolstoy.newcastle.edu.au/R/e2/help/06/11/4803.html
Also see http://www.theresearchkitchen.com/blog/archives/118
Shot in the dark, here, but do you get the same result if you put \usepackage{helvet} after \usepackage{Sweave}? Sometimes order of package declarations matters in LaTeX.
Also, you may find a more knowledgeable audience at the TeX-LaTeX Stack Exchange.

Adjusting Kerning in CSS

Is it possible with CSS to adjust kerning in CSS? I'd like to be able to kern a block of text such that it will actually look like a block of text (both left and right edges are aligned).
EDIT: Using http://letteringjs.com/ in conjunction with http://www.kernjs.com/ makes for pretty good kerning. As for the original problem, http://fittextjs.com/ solves this nicely.
As user Typeoneerror answered, letter-spacing does not influence kerning.
See the kerning concept at Wikipedia.
Kerning is not controlled by letter-spacing, and there are no font-kerning for CSS1 or CSS2. The new specification, CSS3, has not been approved as a standard (W3C Recommendation), but there are a property proposed for font-kerning, see 2012 draft,
https://www.w3.org/TR/css-fonts-3/#font-kerning-prop
Only specific fonts, like OpenFonts, have this property.
CSS not "controls kerning", but if using non-zero letter-spacing the "human kerning perception" can be lost. Example: enhance kerning with letter-spacing:-0.1em and lost with letter-spacing:0.5em.
With CSS1 letter-spacing property you can lost or enhance kerning perception, and into a "letter-spaced text" you can simulate kerning:
<div style="font-size:20pt;background-color:#bcd">
VAST <small>(normal)</small>
<br/>
<span style="letter-spacing:-0.1em">VAST</span>
<small>(enhance perception)</small>
<br/>
<span style="letter-spacing:0.5em">VAST</span>
<small>(lost perception)</small>
<br/>
<!-- SIMULATE KERNING AT SPACED TEXT -->
<div style="letter-spacing:6pt">
SIMULATE: <span style="letter-spacing:4pt">VA</span>ST TEXT
</div>
</div>
See the above example here.
EDIT 2014: I not changed the original text above today, I am opening the answer for your changes (Wiki mode), for proofreading and updates. At the moment this is the most voted answer (21 vs 10) and HTML5 will be a recommendation... Please, help to improve this text (and/or the Wikipedia's linked text!).
Update: CSS3 defines a font-kerning property that can be used to enable or disable kerning for specific elements.
Older answer:
Some control on kerning can be achieved in CSS using the letter-spacing attribute.
However, if all you need is to get "both left and right edges aligned", you might want to try using text-align: justify.
Typographic alignment both left and right is called justification. Kerning is more about the adjustment of spaces between letters, and doesn't have much to do with alignment (because justifying text is more adjustment of spaces between words than characters). Anyway, you want to set the text-align property to justify:
<p style="text-align: justify">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse vestibulum tincidunt ante mollis ornare. Nulla id
nulla justo. Mauris quis sapien ac orci consequat accumsan. Quisque iaculis ipsum ac nulla venenatis sagittis. Aliquam
hendrerit mi a turpis malesuada nec dictum est vehicula. Curabitur quis dolor eu metus malesuada dictum adipiscing et
risus. Aliquam erat volutpat. Aenean pharetra aliquam magna, fringilla tempus erat iaculis eu. Suspendisse potenti.
Sed fringilla lobortis viverra.
</p>
Kerning, letter-spacing (aka tracking) and justify blocks are three different typography properties.
The newest link I found about kerning is from TypeKit, with directions on how to enable the embedded kerning data with their webfonts. http://blog.typekit.com/2014/02/05/kerning-on-the-web/#comment-19916
Manual kerning - adjusting the space between each single letter in a word - will always be a matter of taste and preference. And can be achieved thru kern.js or kerning.js
What makes the TypeKit solution stand out to me, is it enables kerning for all body text automatically by utilizing the meta data in OpenType fonts. I just found it, and am pretty excited to use it in my next project!
For easy reference, the new css properties discussed in the link are:
text-rendering: optimizeLegibility;
font-feature-settings: "kern";
font-kerning: normal;
With prefixes for font-feature-settings including:
-webkit-font-feature-settings: "kern";
-moz-font-feature-settings: "kern";
-moz-font-feature-settings: "kern=1";
Check out my project Jerning.com [see below] for kerning text.
Usage is very simple and is based of pairs of characters, for example:
<h1>Hello World</h1>
The W and o will look weird without kerning.
Simply do:
$('h1').jerning("Wo", -0.1);
which will apply kerning between all upper case Ws and lower case os in h1 tags.
I retired the Jerning project but please find the minified source code below for inclusion in your project if you wish:
(function(b){function e(a,c){var d;if(b.isPlainObject(a))d=a;else try{d=b.parseJSON(a)}catch(f){d=b.parseJSON('{"'+a+'":'+c+"}")}return d}function h(a,c){var d="";b(a).replaceWith(b.map(a.nodeValue.split("").reverse(),function(a,e){var g=a;b.each(c,function(c,e){d==c[1]&&a==c[0]&&(g=b.fn.wrapCharacter(a,e))});d=a;return g}).reverse().join(""))}b.fn.wrapCharacter=function(a,b){return'<span style="letter-spacing:'+b+'em">'+a+"</span>"};b.fn.jerning=function(a,c){var d=e(a,c),f=this.contents();b.each(f,
function(a,c){1==c.nodeType&&b(c).jerning(d);3==c.nodeType&&h(c,d)});return this}})(jQuery);
Unfortunately I don't have the non-minified version any more; the above comes with no guarantees of all cases working!
What seems to be required is dynamic kerning, because what the Thread Opener and also I am/is in need is this: justify does block alignment, as good as possible, by adding space between the words, which leaves "holes" in the text block. Now take instead the line with left align (so no added space), calculate it's physical width, compare with block width available, divide the diffrence trough the number of letters in that line, then use this value as the letterspace addition. This will look more like a newspaper layout than only a text-align:justify. I have to say tho, I am not sure whether the lines in a textblock can be accessed "by line number" in a dynamic page layout, can it?
edit: I tried that yesterday. I use innerHTML to read the content of a text block, then I split and copy it to an array of which each entry/line gets its own DIV tag and id. Then I ajust letterspacing accordingly. Only few of the newest browsers support subpixel-letterspacing, so it works only with medium to big sized fonts. The problem I run into is: due to no Subpixelsupport it works only to some degree, although nice looking, so I tried to additionally justify the result with the text-align attribute, but it's not working after I altered letterspacing.. Left and right alignement works, but not "justify", this one works only before the addition of letterspacing. Could be an opera problem. If I can fix this then I'll post the code.
edit 2. it works now but for some reason I cannot post code here. that is from webkit 10.3.3.13 on mobile. Send me a message if you're interested in the code.

Resources