create framework
by Muthuraman B
HTML
<h1>MyFramework</h1>
<button class="btn" onclick="openModal('demoModal')">Open Modal</button>
<div class="row">
<div class="col col-4">
<div class="card">
<h2>Card Title</h2>
<p>This is a card using MyFramework styles.</p>
</div>
</div>
<div class="col col-4">
<div class="card">
<h2>Another Card</h2>
<p>Cards are responsive and styled with shadows.</p>
</div>
</div>
</div>
<div id="demoModal" class="modal">
<div class="modal-content">
<h3>Modal Header</h3>
<p>This is a modal.</p>
<button class="btn" onclick="closeModal('demoModal')">Close</button>
</div>
</div>
CSS
/* css/myframework.css */
:root {
--primary-color: #007bff;
--secondary-color: #6c757d;
--padding: 1rem;
}
body {
font-family: 'Segoe UI', sans-serif;
line-height: 1.6;
background-color: #f8f9fa;
color: #212529;
padding: 1rem;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
margin-bottom: 1rem;
}
p {
margin-bottom: 1rem;
}
/* Buttons */
.btn {
display: inline-block;
padding: 0.5rem 1rem;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 4px;
text-align: center;
cursor: pointer;
transition: background-color 0.3s;
}
.btn:hover {
background-color: var(--secondary-color);
}
/* Card */
.card {
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 1rem;
margin-bottom: 1rem;
}
/* Grid */
.row {
display: flex;
flex-wrap: wrap;
margin: -0.5rem;
}
.col {
flex: 1;
padding: 0.5rem;
}
.col-6 {
flex: 0 0 50%;
}
.col-4 {
flex: 0 0 33.3333%;
}
/* Modal */
.modal {
display: none;
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.modal-content {
background: white;
margin: 10% auto;
padding: 2rem;
width: 80%;
border-radius: 8px;
max-width: 500px;
}
.modal.show {
display: block;
}
JavaScript
function openModal(id) {
document.getElementById(id).classList.add('show');
}
function closeModal(id) {
document.getElementById(id).classList.remove('show');
}