Hello,
I am a French teacher and am working with a wordpress template in creating a site about teaching French. I have set up the navbar to show the pages on the site. Currently the site is in French only but I would like to make it bilingual. I have tried adding the English title to each page, in the hopes that it would show under the French title, however what ends up happening is it superimposes itself on top of the title below it instead of making space for it in its own spot.
How do I change the css so that if a page title is long it automatically adds a line below the page title?
I've managed to change the overflow issue (titles superimposing on the ones below) by adding height: auto; to the list attributes but I can't seem to control how the title breaks. If the page title is too short, it all stays on one line and if I try to extend things by adding spaces it doesn't want to do anything for me. Ideally I want the French title on top and the English underneath for all page titles so that it looks balanced.
You would need to add a <br /> element between the French and English statements. I'm not sure if WP will strip that back out when posting the content or not though.
Otherwise you need to add white-space:pre; to the CSS for those links:
Code:
#categories li a {white-space:pre;}
Since you have line breaks in your actual code that should work - but you will need to remove the extra spaces as they will all be represented now.
SB65's method or the white-space:pre; method would work.
Or if you actually do want them to be separated on the inner page headings as well you could update your CSS there the same way you updated your menu links (get rid of the specified height for .post h2 and let them flow down). For that you would also need to update your background images to accommodate the extra height.
Yes, in your original page your source code had line breaks in it, meaning that rather than this:
Code:
<a title="Page d’accueil – Home page" href="http://tracyrosen.com/parents">Page d’accueil – Home page</a>
Your code looked like this:
Code:
<a title="Page d’accueil – Home page" href="http://tracyrosen.com/parents">Page d’accueil
– Home page</a>
Notice that you had entered a line-break character in there (presumably you hit the "enter" key while typing in the admin section to name it) such that the English part was actually on the next line of source code. The white-space:pre; method would require you to do that again as it's method of display is to honor all "whitespace" which is spaces and line breaks.
So if you edit your names to use line breaks this will work.
Otherwise, you can go with the <span> method suggested by SB65 which is also perfectly workable.
But that would once again give me line breaks on the page itself.
To recap - I am trying to create a navbar that allows me to place a French page title with the English translation below it however for the actual page I do not want there to be a break between the French and English titles.
Basically I need the same text to act differently in 2 different areas of the webpage.
I'm thinking the only way around this is to create page titles that are long enough to force the English to the 2nd line in the navbar but not too long for the individual page.
Either solution should be fine since in both cases the css is being applied only to the navbar and not to the content on the page - so on the page you give #categories li a applies to all links within your navbar only.
It doesn't affect the title of your page "Page d’accueil – Home page" since that isn't affected by the #categories li a css statement.
EDIT: So to clarify, if you can get a return character in your page title, or insert a <span> into your page title, then the css can target the text in the navbar only to achieve the effect you want.
Either solution should be fine since in both cases the css is being applied only to the navbar and not to the content on the page - so on the page you give #categories li a applies to all links within your navbar only.
It doesn't affect the title of your page "Page d’accueil – Home page" since that isn't affected by the #categories li a css statement.
EDIT: So to clarify, if you can get a return character in your page title, or insert a <span> into your page title, then the css can target the text in the navbar only to achieve the effect you want.
No matter what, when I put a return character in the title it displays it on the individual page. So the <br /> won't work for this.
Code:
<span>
tags are working I'm not exactly sure how... is it that white-spacere; tells the html to make a line break? Because I do not have to physically place a break into the title for it to work.
Now I just need to alter the page title font size for it to fit into the space for the title on the individual pages.