3 added 3 characters in body
source | link

Add this in default.xml in the below path

app/code/vendor/module/view/frontend/layout/default.xml

or

app/design/frontend/vendor/theme-name/Magento_Theme/layout/default.xml

default.xml will render in all the pages so it's an global declaration.

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="topdestination="header.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

Add this in default.xml in the below path

app/code/vendor/module/view/frontend/layout/default.xml

or

app/design/frontend/vendor/theme-name/Magento_Theme/layout/default.xml

default.xml will render in all the pages so it's an global declaration.

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="top.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

Add this in default.xml in the below path

app/code/vendor/module/view/frontend/layout/default.xml

or

app/design/frontend/vendor/theme-name/Magento_Theme/layout/default.xml

default.xml will render in all the pages so it's an global declaration.

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="header.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

2 added 77 characters in body
source | link

Add this in default.xml in the below path

app/code/vendor/module/view/frontend/layout/default.xml

or

app/design/frontend/vendor/theme-name/Magento_Theme/layout/default.xml

default.xml will render in all the pages so it's an global declaration.

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="top.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

Add this in default.xml

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="top.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

Add this in default.xml in the below path

app/code/vendor/module/view/frontend/layout/default.xml

or

app/design/frontend/vendor/theme-name/Magento_Theme/layout/default.xml

default.xml will render in all the pages so it's an global declaration.

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="top.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.

1
source | link

Add this in default.xml

<?xml version="1.0"?>                                                     
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <move element="messages" destination="top.container" after='-' />
</body>                                                                  
</page>

Not tested try it and let me know.