Need help with the html/css code
Autor: Ionescu C.Hello,
I have added a section to my website show more/less.
This is the code that I have used:
HEAD
CSS
<style>
/* Initially, hide the extra text that
can be revealed with the button */
#moreText {
/* Display nothing for the element */
display: none;
}
</style>
BODY
JAVA
<script>
function toggleText() {
// Get all the elements from the page
var points =
document.getElementById("points");
var showMoreText =
document.getElementById("moreText");
var buttonText =
document.getElementById("textButton");
// If the display property of the dots
// to be displayed is already set to
// 'none' (that is hidden) then this
// section of code triggers
if (points.style.display === "none") {
// Hide the text between the span
// elements
showMoreText.style.display = "none";
// Show the dots after the text
points.style.display = "inline";
// Change the text on button to
// 'Show More'
buttonText.innerHTML = "Show More";
}
// If the hidden portion is revealed,
// we will change it back to be hidden
else {
// Show the text between the
// span elements
showMoreText.style.display = "inline";
// Hide the dots after the text
points.style.display = "none";
// Change the text on button
// to 'Show Less'
buttonText.innerHTML = "Show Less";
}
}
</script>
And the BODY/HTML part
<h1 style="color: black;">
</h1>
<h3>Title </h3>
<pre> </pre>
<p>
<p style="font-size:90%;"<p style="font-family:Roboto;"> Lorem ipsum tecrtgh gu ooioad udfuennen fvjjfuunela lloorteuynbe </p>
<span id="points">...</span>
<!-- Define the text that would be
hidden by default and only shown
when clicked on the button -->
<span id="moreText"<p style="font-size:90%;"<p style="font-family:Roboto;"> Lorem ipsun goadghteh ghhyei lor oouurerh nahhennkke
<pre> </pre>
Lorem ipsonem mutuilor lplaot adashjhn anad jgsdfgue lkaloekke
<pre> </pre>
text lorempuaionsad aguatahtr aff,asjdakiu fa aslkplorem pipsioandiae
</span>
</p>
<pre> </pre>
<!-- Trigger toggleText() when the
button is clicked -->
<button onclick="toggleText()" id="textButton";>
More Details
</button>
Now, I wold like to change the button (show less/more), I wold like to change the color/font/position, and I don't know what parameters to add/change.
Any help would be much appreciated.
Regards,
Cristi
Why not use the one from x5?
https://market.websitex5.com/en/objects/526c4939-3abc-41c3-b34a-37baa6a14af
... button 1:
<button onclick="toggleText()" style="background-color:yellow;color:red;font-size:24px;border-radius:10px">
More Details
</button>
... button 2 + rollover:
<button onclick="toggleText()" onmouseover="this.style.color='blue'" onmouseout="this.style.color='red'" style="background-color:yellow;color:red;font-size:24px;border-radius:10px">
More Details
</button>
.
ciao
.
Autor
Hello,
You are awesome!!!
Thank you!