skip to Main Content

the p tag text "would you recommend our website to other" doesn’t appear in 2nd div tag within body tag. but if i cut and paste it in within first div it appears but for some reason it doesn’t in 2nd div tag. there is no text color issue as well.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        select {
            display: block;
        }
    </style>
</head>

<body>
    <div>
        <label for="desc-input" class="name-label">Which option best describe your current situation?</label>
        <select type="dropdown" class="form-control" name="desc-input" required>
            <option disabled selected value="select current role">select your current role</option>
            <option value="">student</option>
            <option value="">Teacher</option>
            <option value="">Professional</option>

    </div>
    <div>
        <p>Would you recommend our website to others?</p>
        <label><input type="radio" class="radio" name="radio" value="Definitely" checked> Definitely </label>
        <label><input type="radio" class="radio" name="radio" value="Maybe"> Maybe </label>
        <label><input type="radio" class="radio" name="radio" value="Never"> Never </label>
    </div>
</body>

</html>

2

Answers


  1. You forgot to close select tag.

    To see the result click on Run code snippet button:

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <title>Document</title>
        <style>
            select {
                display: block;
            }
        </style>
    </head>
    
    <body>
        <div>
            <label for="desc-input" class="name-label">Which option best describe your current situation?</label>
            <select type="dropdown" class="form-control" name="desc-input" required>
                <option disabled selected value="select current role">select your current role</option>
                <option value="">student</option>
                <option value="">Teacher</option>
                <option value="">Professional</option>
            </select>
        </div>
        <div>
            <p>Would you recommend our website to others?</p>
            <label><input type="radio" class="radio" name="radio" value="Definitely" checked> Definitely </label>
            <label><input type="radio" class="radio" name="radio" value="Maybe"> Maybe </label>
            <label><input type="radio" class="radio" name="radio" value="Never"> Never </label>
        </div>
    </body>
    
    </html>

    Sidenote:

    Although it wasn’t the cause of the error, it is still a good practice to use correct syntax for <meta> tags too:

    <meta charset="UTF-8"> is wrong because it is not closed properly.

    correct syntax:

    <meta charset="UTF-8"/>
    
    Login or Signup to reply.
  2. It seems like you are missing the closing tag in the first . This can cause the element to extend beyond its intended boundaries and potentially overlap with the content of the second , preventing the text "Would you recommend our website to others?" from being displayed.

    Here’s your corrected HTML code:

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            select {
                display: block;
            }
        </style>
    </head>
    
    <body>
        <div>
            <label for="desc-input" class="name-label">Which option best describes your current situation?</label>
            <select type="dropdown" class="form-control" name="desc-input" required>
                <option disabled selected value="select current role">select your current role</option>
                <option value="">student</option>
                <option value="">Teacher</option>
                <option value="">Professional</option>
            </select> <!-- This closing tag was missing -->
        </div>
        <div>
            <p>Would you recommend our website to others?</p>
            <label><input type="radio" class="radio" name="radio" value="Definitely" checked> Definitely </label>
            <label><input type="radio" class="radio" name="radio" value="Maybe"> Maybe </label>
            <label><input type="radio" class="radio" name="radio" value="Never"> Never </label>
        </div>
    </body>
    
    </html>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search