If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

onclick to show more is not showing text next to previous text

Can anyone tell me why they think the following code is not showing the text beside the rest of the text.

What I was after is to have the visitor click the 'show more' link which opens up the rest of the text, but it is not showing it next to the text already there, it is breaking the text up with a new line. how can I get it so the text is all together, but at all times centered.

I took the liberty to format your code so it’s easier to see where an element starts and ends.

One of the two issues is this, I guess:

Code:

document.getElementById(shID).style.display = 'block';

If you display an element as block-level element it invokes a line break before and after itself.
Secondly, if you want centered text, don’t float it. text-align: center is only working on inline content and not on elements that are floated, because these are basically behaving as block elements.

Ah I think I understand what you mean. What method should I be using to achieve this effect. What is the correct way to hide/show the elements so I do not get the line-break ?

Originally Posted by VIPStephan

I took the liberty to format your code so it’s easier to see where an element starts and ends.

One of the two issues is this, I guess:

Code:

document.getElementById(shID).style.display = 'block';

If you display an element as block-level element it invokes a line break before and after itself.
Secondly, if you want centered text, don’t float it. text-align: center is only working on inline content and not on elements that are floated, because these are basically behaving as block elements.