W3.CSS

W3.CSS الصفحة الرئيسية W3.CSS مقدمة ألوان W3.CSS حاويات W3.CSS لوحات W3.CSS حدود W3.CSS بطاقات W3.CSS افتراضيات W3.CSS خطوط W3.CSS W3.CSS جوجل نص W3.CSS جولة W3.CSS حشوة W3.CSS هوامش W3.CSS عرض W3.CSS أزرار W3.CSS ملاحظات W3.CSS اقتباسات W3.CSS تنبيهات W3.CSS جداول W3.CSS قوائم W3.CSS صور W3.CSS مدخلات W3.CSS شارات W3.CSS علامات W3.CSS أيقونات W3.CSS W3.CSS مستجيب W3.CSS تخطيط الرسوم المتحركة W3.CSS تأثيرات W3.CSS أشرطة W3.CSS القوائم المنسدلة W3.CSS أكورديون W3.CSS W3.CSS التنقل W3.CSS الشريط الجانبي علامات تبويب W3.CSS W3.CSS ترقيم الصفحات أشرطة تقدم W3.CSS عرض شرائح W3.CSS W3.CSS مشروط W3.CSS Tooltips شبكة W3.CSS كود W3.CSS مرشحات W3.CSS اتجاهات W3.CSS حالة W3.CSS مادة W3.CSS التحقق من صحة W3.CSS إصدارات W3.CSS W3.CSS موبايل

ألوان W3.CSS

فئات ألوان W3.CSS W3.CSS لون المواد W3.CSS Color Flat UI W3.CSS Color Metro UI W3.CSS لون Win8 W3.CSS Color iOS W3.CSS لون الموضة مكتبات ألوان W3.CSS أنظمة ألوان W3.CSS ثيمات ألوان W3.CSS W3.CSS Color Generator

بناء الويب

مقدمة الويب ويب HTML Web CSS جافا سكريبت الويب تخطيط ويب فرقة الويب تقديم الطعام على شبكة الإنترنت مطعم ويب مهندس الويب

أمثلة

أمثلة W3.CSS عروض W3.CSS قوالب W3.CSS

مراجع

مرجع W3.CSS تنزيلات W3.CSS

W3.CSS مشروط


الشرط هو مربع حوار / نافذة منبثقة يتم عرضها أعلى الصفحة الحالية:

×

Modal Header

Hello World!

Go back to W3.CSS Modal to learn more!

Modal Footer Close


فئات W3.CSS المشروطة

يوفر W3.CSS الفئات التالية للنوافذ المشروطة:

فصل يعرّف
w3- مشروط الحاوية المشروطة
w3- محتوى مشروط المحتوى المشروط

إنشاء مشروط

تحدد فئة w3-modal حاوية للشكل .

تحدد فئة المحتوى المشروط w3 المحتوى الشرطي.

يمكن أن يكون المحتوى الشرطي أي عنصر HTML (divs والعناوين والفقرات والصور وما إلى ذلك).

مثال

<!-- Trigger/Open the Modal -->
<button onclick="document.getElementById('id01').style.display='block'"
class="w3-button">Open Modal</button>

<!-- The Modal -->
<div id="id01" class="w3-modal">
  <div class="w3-modal-content">
    <div class="w3-container">
      <span onclick="document.getElementById('id01').style.display='none'"
      class="w3-button w3-display-topright">&times;</span>
      <p>Some text in the Modal..</p>
      <p>Some text in the Modal..</p>
    </div>
  </div>
</div>


افتح مشروط

استخدم أي عنصر HTML لفتح النموذج. ومع ذلك ، غالبًا ما يكون هذا زرًا أو ارتباطًا.

أضف سمة onclick وأشر إلى معرف النموذج ( id01 في مثالنا) ، باستخدام طريقة document.getElementById ().


إغلاق مشروط

لإغلاق مشروط ، أضف فئة الزر w3 إلى عنصر مع سمة onclick التي تشير إلى معرف الشرطي ( id01 ). يمكنك أيضًا إغلاقه بالنقر خارج النموذج (انظر المثال أدناه).

نصيحة: مرات؛ هو كيان HTML المفضل للرموز القريبة ، بدلاً من الحرف "x".


رأس وتذييل مشروط

استخدم فئات w3-container لإنشاء أقسام مختلفة داخل المحتوى الشرطي:

×

Modal Header

Some text..

Some text..

Modal Footer

مثال

<div id="id01" class="w3-modal">
  <div class="w3-modal-content">

    <header class="w3-container w3-teal">
      <span onclick="document.getElementById('id01').style.display='none'"
      class="w3-button w3-display-topright">&times;</span>
      <h2>Modal Header</h2>
    </header>

    <div class="w3-container">
      <p>Some text..</p>
      <p>Some text..</p>
    </div>

    <footer class="w3-container w3-teal">
      <p>Modal Footer</p>
    </footer>

  </div>
</div>

مشروط كبطاقة

لعرض النموذج كبطاقة ، أضف إحدى فئات w3-card- * إلى حاوية محتوى w3-modal :

×

Modal Header

Some text..

Some text..

Modal Footer

مثال

<div class="w3-modal-content w3-card-4">

الوسائط المتحركة

استخدم أيًا من فئات w3-animate-zoom | أعلى | أسفل | يمين | يسار للانزلاق في النموذج من اتجاه معين:

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

×

Modal Header

Some text..

Some text..

Modal Footer

مثال

<div class="w3-modal-content w3-animate-zoom">
<div class="w3-modal-content w3-animate-top">
<div class="w3-modal-content w3-animate-bottom">
<div class="w3-modal-content w3-animate-left">
<div class="w3-modal-content w3-animate-right">
<div class="w3-modal-content w3-animate-opacity">

يمكنك أيضًا التلاشي في لون الخلفية الشرطي عن طريق تعيين فئة w3-animate-opacity على عنصر w3-modal:

مثال

<div class="w3-modal w3-animate-opacity">

صورة مشروطة

اضغط على الصورة لعرضها على شكل شكلي بالحجم الكامل:

النرويج
×
Norway

مثال

<img src="img_snowtops.jpg" onclick="document.getElementById('modal01').style.display='block'" class="w3-hover-opacity">

<div id="modal01" class="w3-modal w3-animate-zoom" onclick="this.style.display='none'">
  <img class="w3-modal-content" src="img_snowtops.jpg">
</div>

معرض الصور المشروطة

اضغط على الصورة لعرضها بالحجم الكامل:

×

مثال

<div class="w3-row-padding">
  <div class="w3-container w3-third">
    <img src="img_snowtops.jpg" style="width:100%" onclick="onClick(this)">
  </div>
  <div class="w3-container w3-third">
    <img src="img_lights.jpg" style="width:100%" onclick="onClick(this)">
  </div>
  <div class="w3-container w3-third">
    <img src="img_mountains.jpg" style="width:100%" onclick="onClick(this)">
  </div>
</div>

<div id="modal01" class="w3-modal" onclick="this.style.display='none'">
  <img class="w3-modal-content" id="img01" style="width:100%">
</div>

<script>
function onClick(element) {
  document.getElementById("img01").src = element.src;
  document.getElementById("modal01").style.display = "block";
}
</script>

نموذج تسجيل الدخول المشروط

ينشئ هذا المثال نموذجًا لتسجيل الدخول:


× Avatar
Remember me
Forgot password?

مثال


مشروط مع المحتوى المبوب

ينشئ هذا المثال نموذجًا بمحتوى مبوب:

×

Header

London

London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

مثال


Close the Modal

In the examples above, we use a button to close the modal. However, with a little bit of JavaScript, you can also close the modal when clicking outside of the modal box:

Example

// Get the modal
var modal = document.getElementById('id01');

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

Advanced: Lightbox (Modal Image Gallery)

This example shows how to add an image slideshow inside a modal, to create a "lightbox":

×

Nature and sunrise

Nature and sunrise
French Alps
Mountains and fjords

Example

Click on an image:

Tip: To learn more about slideshows, visit our W3.CSS Slideshow chapter.