why does HTML Tag not working in Post and Page

[*]

It’s not the theme that’s how TinyMCE editor works. If you remain on the “Text” tab and update the post then the html will remain untouched and display properly on the front-end. However if you switch back to the “visual editor” it will break.

Here, you can use this on your functions.php

    // Modify Tiny_MCE init
add_filter('tiny_mce_before_init', 'smartenTinyMCE' );
function smartenTinyMCE($init) {
    // Add PRE and CODE to the block formats menu
    $init['theme_advanced_blockformats'] = 'h2,h3,h4,h5,h6,p,blockquote,pre,code';

    // Allow extra attributes for some syntax highlighters, IE: <pre lang="php" line="5">...</pre)
    // Allow iFrames for live examples
    $init['extended_valid_elements'] = 'pre[*]';

    return $init;
}

Source: https://provideyourown.com/2011/how-to-insert-code-into-your-wordpress-blog/

PS: You can add more separated by comma example:

$init['extended_valid_elements'] = 'pre[*],code[*],iframe[*]';

[*]