Search code examples
javascriptcssoverlaycenter

ASP.NET C# Javascript div Centering


I want to, when the user clicks a button on my website, to make a DIV appear in the center of the browser above all other content on the website. I have created the DIV and even have the visible/hidden thingy figured out. The overlaying and the centering parts are what I am unable to understand.


Solution

  • You're talking about a shadowbox/modal window. Microsoft provides an example of this in their AJAX control toolkit if you want to stay strictly C#. This can also be done easily with third party API's, using jQuery, such as ShadowBox.js or DOM Window

    The works done for you. You just need to plug it in.