وبلاگ حرفهای | قالب مدرن
/* Reset و فونت */
:root {
--primary-color: #4a6bff;
--secondary-color: #ff6b6b;
--dark-color: #2c3e50;
--light-color: #f8f9fa;
--gray-color: #95a5a6;
--transition: all 0.3s ease;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: var(--light-color);
color: var(--dark-color);
line-height: 1.8;
}
/* هدر */
header {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
padding: 3rem 0;
text-align: center;
position: relative;
overflow: hidden;
}
header::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('https://images.unsplash.com/photo-1499750310107-5fef28a66643?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') center/cover;
opacity: 0.2;
z-index: 0;
}
.header-content {
position: relative;
z-index: 1;
max-width: 800px;
margin: 0 auto;
padding: 0 1rem;
}
header h1 {
font-size: 3rem;
margin-bottom: 1rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
header p {
font-size: 1.2rem;
opacity: 0.9;
margin-bottom: 2rem;
}
.search-bar {
max-width: 500px;
margin: 0 auto;
position: relative;
}
.search-bar input {
width: 100%;
padding: 12px 20px;
border: none;
border-radius: 50px;
font-size: 1rem;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.search-bar button {
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: var(--primary-color);
cursor: pointer;
}
/* ناوبری */
nav {
background-color: white;
padding: 1rem 0;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.nav-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 2rem;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-color);
text-decoration: none;
}
.nav-links {
display: flex;
list-style: none;
}
.nav-links li {
margin-right: 1.5rem;
position: relative;
}
.nav-links a {
color: var(--dark-color);
text-decoration: none;
font-weight: 500;
transition: var(--transition);
padding: 0.5rem 0;
}
.nav-links a:hover {
color: var(--primary-color);
}
.nav-links li.active a {
color: var(--primary-color);
}
.nav-links li.active::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 3px;
background-color: var(--primary-color);
border-radius: 3px;
}
.mobile-menu {
display: none;
font-size: 1.5rem;
cursor: pointer;
}
/* محتوا */
.container {
max-width: 1200px;
margin: 3rem auto;
padding: 0 2rem;
display: grid;
grid-template-columns: 1fr 300px;
gap: 2rem;
}
main {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 2rem;
}
.post {
background: white;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
transition: var(--transition);
}
.post:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.post-img {
height: 200px;
overflow: hidden;
}
.post-img img {
width: 100%;
height: 100%;
object-fit: cover;
transition: var(--transition);
}
.post:hover .post-img img {
transform: scale(1.05);
}
.post-content {
padding: 1.5rem;
}
.post-category {
display: inline-block;
padding: 0.3rem 0.8rem;
background-color: var(--primary-color);
color: white;
border-radius: 50px;
font-size: 0.8rem;
margin-bottom: 1rem;
}
.post-title {
font-size: 1.3rem;
margin-bottom: 1rem;
color: var(--dark-color);
}
.post-title a {
color: inherit;
text-decoration: none;
transition: var(--transition);
}
.post-title a:hover {
color: var(--primary-color);
}
.post-excerpt {
color: var(--gray-color);
margin-bottom: 1.5rem;
}
.post-meta {
display: flex;
justify-content: space-between;
align-items: center;
color: var(--gray-color);
font-size: 0.9rem;
}
.post-author {
display: flex;
align-items: center;
}
.post-author img {
width: 30px;
height: 30px;
border-radius: 50%;
margin-left: 0.5rem;
}
/* سایدبار */
aside {
position: sticky;
top: 100px;
height: fit-content;
}
.sidebar-widget {
background: white;
border-radius: 10px;
padding: 1.5rem;
margin-bottom: 2rem;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
.widget-title {
font-size: 1.2rem;
margin-bottom: 1.5rem;
padding-bottom: 0.8rem;
border-bottom: 2px solid #eee;
position: relative;
}
.widget-title::after {
content: '';
position: absolute;
bottom: -2px;
right: 0;
width: 50px;
height: 2px;
background-color: var(--primary-color);
}
.about-widget img {
width: 100%;
border-radius: 10px;
margin-bottom: 1rem;
}
.about-widget p {
margin-bottom: 1rem;
}
.social-links {
display: flex;
justify-content: center;
gap: 1rem;
}
.social-links a {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #f1f1f1;
color: var(--dark-color);
transition: var(--transition);
}
.social-links a:hover {
background-color: var(--primary-color);
color: white;
}
.category-list {
list-style: none;
}
.category-list li {
margin-bottom: 0.8rem;
}
.category-list a {
display: flex;
justify-content: space-between;
color: var(--dark-color);
text-decoration: none;
transition: var(--transition);
padding: 0.5rem 0;
}
.category-list a:hover {
color: var(--primary-color);
}
.category-list span {
background-color: #f1f1f1;
padding: 0.2rem 0.5rem;
border-radius: 50px;
font-size: 0.8rem;
}
.popular-posts {
list-style: none;
}
.popular-post {
display: flex;
margin-bottom: 1rem;
align-items: center;
}
.popular-post-img {
width: 60px;
height: 60px;
border-radius: 8px;
overflow: hidden;
margin-left: 1rem;
flex-shrink: 0;
}
.popular-post-img img {
width: 100%;
height: 100%;
object-fit: cover;
}
.popular-post-content h4 {
font-size: 0.9rem;
margin-bottom: 0.3rem;
}
.popular-post-content h4 a {
color: var(--dark-color);
text-decoration: none;
transition: var(--transition);
}
.popular-post-content h4 a:hover {
color: var(--primary-color);
}
.popular-post-content span {
font-size: 0.8rem;
color: var(--gray-color);
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.tag {
display: inline-block;
padding: 0.3rem 0.8rem;
background-color: #f1f1f1;
border-radius: 50px;
font-size: 0.8rem;
color: var(--dark-color);
text-decoration: none;
transition: var(--transition);
}
.tag:hover {
background-color: var(--primary-color);
color: white;
}
/* فوتر */
footer {
background-color: var(--dark-color);
color: white;
padding: 4rem 0 2rem;
}
.footer-container {
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
padding: 0 2rem;
}
.footer-widget h3 {
font-size: 1.3rem;
margin-bottom: 1.5rem;
position: relative;
padding-bottom: 0.8rem;
}
.footer-widget h3::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 50px;
height: 2px;
background-color: var(--primary-color);
}
.footer-widget p {
margin-bottom: 1.5rem;
opacity: 0.8;
}
.footer-links {
list-style: none;
}
.footer-links li {
margin-bottom: 0.8rem;
}
.footer-links a {
color: white;
opacity: 0.8;
text-decoration: none;
transition: var(--transition);
}
.footer-links a:hover {
opacity: 1;
padding-right: 5px;
}
.footer-contact li {
margin-bottom: 1rem;
display: flex;
align-items: center;
}
.footer-contact i {
margin-left: 0.8rem;
color: var(--primary-color);
}
.copyright {
text-align: center;
padding-top: 2rem;
margin-top: 2rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
opacity: 0.7;
font-size: 0.9rem;
}
/* دکمه بازگشت به بالا */
.back-to-top {
position: fixed;
bottom: 30px;
left: 30px;
width: 50px;
height: 50px;
background-color: var(--primary-color);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
cursor: pointer;
opacity: 0;
visibility: hidden;
transition: var(--transition);
z-index: 99;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.back-to-top.active {
opacity: 1;
visibility: visible;
}
.back-to-top:hover {
background-color: var(--secondary-color);
transform: translateY(-5px);
}
/* رسپانسیو */
@media (max-width: 992px) {
.container {
grid-template-columns: 1fr;
}
aside {
position: static;
margin-top: 3rem;
}
}
@media (max-width: 768px) {
.nav-container {
padding: 0 1rem;
}
.nav-links {
position: fixed;
top: 70px;
right: -100%;
width: 80%;
height: calc(100vh - 70px);
background-color: white;
flex-direction: column;
align-items: center;
padding: 2rem 0;
transition: var(--transition);
box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}
.nav-links.active {
right: 0;
}
.nav-links li {
margin: 1rem 0;
}
.mobile-menu {
display: block;
}
header h1 {
font-size: 2.2rem;
}
.post-title {
font-size: 1.1rem;
}
}
@media (max-width: 576px) {
main {
grid-template-columns: 1fr;
}
.footer-container {
grid-template-columns: 1fr;
}
}
وبلاگ حرفهای
بهترین مطالب در زمینه طراحی وب، برنامهنویسی و فناوری
برنامهنویسی
در این مقاله به بررسی جامع کتابخانه React.js میپردازیم و یاد میگیریم چگونه اپلیکیشنهای مدرن وب بسازیم.
طراحی وب
با جدیدترین ویژگیهای CSS آشنا شوید و طراحیهای خلاقانهتری خلق کنید.
هوش مصنوعی
چگونه هوش مصنوعی در حال تغییر صنعت نرمافزار است و چه فرصتهایی ایجاد میکند.
توسعه وب
راهکارهای عملی برای بهبود سرعت و تجربه کاربری در وبسایتها.
تحلیل داده
چگونه از پایتون برای تحلیل دادهها و ایجاد بینشهای تجاری استفاده کنیم.
امنیت سایبری
با مهمترین تهدیدات امنیتی در توسعه وب و راههای مقابله با آنها آشنا شوید.
من یک توسعهدهنده وب و نویسنده فنی هستم که عاشق به اشتراک گذاری دانش و تجربیاتم در این زمینه هستم.
درباره وبلاگ
وبلاگ حرفهای یک منبع آموزشی برای توسعهدهندگان و طراحان وب است که به اشتراک گذاری دانش و تجربیات در زمینه فناوری اطلاعات میپردازد.
تماس با ما
تهران، خیابان آزادی، دانشگاه صنعتی شریف
+98 21 1234 5678
info@profblog.ir
تمامی حقوق محفوظ است © ۱۴۰۲ وبلاگ حرفهای
// منوی موبایل
const mobileMenu = document.querySelector('.mobile-menu');
const navLinks = document.querySelector('.nav-links');
mobileMenu.addEventListener('click', () => {
navLinks.classList.toggle('active');
mobileMenu.innerHTML = navLinks.classList.contains('active') ?
' ' : ' ';
});
// دکمه بازگشت به بالا
const backToTop = document.querySelector('.back-to-top');
window.addEventListener('scroll', () => {
if (window.pageYOffset > 300) {
backToTop.classList.add('active');
} else {
backToTop.classList.remove('active');
}
});
backToTop.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
// هایلایت منوی فعال
const navItems = document.querySelectorAll('.nav-links li');
navItems.forEach(item => {
item.addEventListener('click', () => {
navItems.forEach(i => i.classList.remove('active'));
item.classList.add('active');
// در حالت موبایل منو را ببند
if (window.innerWidth <= 768) {
navLinks.classList.remove('active');
mobileMenu.innerHTML = ' ';
}
});
});