أكيد! إليك سكريبت HTML + CSS بسيط لوضع إعلانيْن بجوار بعض (جنباً إلى جنب) بمقاس 300×250 بيكسل، وهو مقاس شائع جدًا في إعلانات أدسنس أو الشبكات الإعلانية الأخرى.
سكريبت وضع اعلانين بمقاس (300 × 250 ) بجوار بعض
.code-box {
position: relative;
background: #272822;
color: #f8f8f2;
border-radius: 10px;
padding: 15px;
margin: 20px auto;
font-family: monospace;
direction: ltr;
overflow: auto;
}
.code-box textarea {
width: 100%;
height: 250px;
background: transparent;
border: none;
color: #f8f8f2;
resize: none;
font-size: 14px;
outline: none;
}
.code-buttons {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 10px;
}
.code-buttons button {
padding: 8px 12px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: 0.3s;
}
.code-buttons button:hover {
background-color: #0056b3;
}
إعلانيْن بجوار بعض
.ads-container {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
margin: 20px 0;
}
.ad-box {
width: 300px;
height: 250px;
background-color: #eee;
border: 1px solid #ccc;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #555;
}
@media(max-width: 640px) {
.ads-container {
flex-direction: column;
align-items: center;
}
}
إعلانات
إعلان 1 (300×250)
إعلان 2 (300×250)
function copyCode() {
const code = document.getElementById(“myCode”);
code.select();
document.execCommand(“copy”);
alert(“تم نسخ الكود!”);
}
function downloadCode() {
const code = document.getElementById(“myCode”).value;
const blob = new Blob(, { type: “text/plain” });
const link = document.createElement(“a”);
link.href = URL.createObjectURL(blob);
link.download = “code.html”;
link.click();
}
function clearCode() {
if (confirm(“هل أنت متأكد من مسح الكود؟”)) {
document.getElementById(“myCode”).value = “”;
}
}
💡 طريقة الاستخدام:
استبدل محتوى كل div class=”ad-box” بكود إعلان أدسنس أو أي كود إعلان خاص بك.
الكود متجاوب، سيظهر الإعلانيْن جنبًا إلى جنب على الشاشات الكبيرة، وتحت بعض على الجوال 📱.
مثال إدراج كود أدسنس:
.code-box {
position: relative;
background: #272822;
color: #f8f8f2;
border-radius: 10px;
padding: 15px;
margin: 20px auto;
font-family: monospace;
direction: ltr;
overflow: auto;
}
.code-box textarea {
width: 100%;
height: 250px;
background: transparent;
border: none;
color: #f8f8f2;
resize: none;
font-size: 14px;
outline: none;
}
.code-buttons {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 10px;
}
.code-buttons button {
padding: 8px 12px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: 0.3s;
}
.code-buttons button:hover {
background-color: #0056b3;
}
(adsbygoogle = window.adsbygoogle || []).push({});
function copyCode() {
const code = document.getElementById(“myCode”);
code.select();
document.execCommand(“copy”);
alert(“تم نسخ الكود!”);
}
function downloadCode() {
const code = document.getElementById(“myCode”).value;
const blob = new Blob(, { type: “text/plain” });
const link = document.createElement(“a”);
link.href = URL.createObjectURL(blob);
link.download = “code.html”;
link.click();
}
function clearCode() {
if (confirm(“هل أنت متأكد من مسح الكود؟”)) {
document.getElementById(“myCode”).value = “”;
}
}
هل تحب أجهز لك نسخة HTML جاهزة للتحميل بملف .zip؟


أضف تعليق