MARKDOWN Course

Dropdown

Go back

You can make a dropdown like this in HTML (I added the border)

Click here Content

with this code

<details>
<summary>Click here</summary>
Content
</details>

Open by default

You can make it open by default

Click here Content

with this code (I added the border)

<details>
<summary>Click here</summary>
Content
</details>

Example

You can look at this amazing example that I found here, which I modified a bit.

Click here to see the answer
Could you guess what's this code doing?
public class Math {
    private static final float value = 2.0;
    public static float increaseN(float n){ return n + value; }
}

Answer

It's not working! 2.0 is a double not a float! But increase n is working properly and return n plus the value 2.

The corresponding code is

<blockquote>
<table><tbody><tr></tr><tr><td>
<details>
<summary><span><b>Click here to see the answer</b></span>

<h6>Could you guess what's this code doing?</h6>

```java
public class Math {
    private static final float value = 2.0;
    public static float increaseN(float n){ return n + value; }
}
```
</summary><hr>
<h6>Answer</h6>

It's not working! **2.0** is a double not a float! But increase n
is working properly and return n plus the value 2.
</details></td></tr></tbody>
</table>
</blockquote>