html - How can I create a DIV that's located in the center of my browser screen? -


मैंने निम्नलिखित की कोशिश की:

  & lt; body style = "height: 100%; "& gt; & Lt; div शैली = "प्रदर्शन: ब्लॉक; ऊंचाई: 30rem; चौड़ाई: 100rem; मार्जिन: ऑटो;" & gt; एक्स & lt; / div & gt; & Lt; / body & gt;   

ऐसा क्या होता है कि बॉक्स सही दाएं और बाएं मार्जिन के साथ केंद्रित होता है लेकिन ऊपर और नीचे में कोई मार्जिन नहीं लगता है। नोट 1rem के बारे में 10px के बराबर है, इसलिए ऊपर और नीचे पर बहुत सारे स्थान होना चाहिए। हालांकि, DIV सिर्फ स्क्रीन के शीर्ष पर बैठता है।

इसी तरह:

  #yourdiv {स्थिति: तय; ऊंचाई: 18em; मार्जिन-टॉप: -9em; मार्जिन-बाएं: -15 एएम; सीमा: 1px ठोस # सीसीसी; पृष्ठभूमि रंग: # एफ 3 एफ 3 एफ 3; शीर्ष: 50%; बाएं: 50%; चौड़ाई: 30em; }    

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -