<DIV CLASS="container"> <DIV CLASS="copyright">© nikhil.com • 2024</DIV> <IMG…
- User
- Assistant
To achieve the layout you described with styling for both desktop and mobile views, you can use CSS Flexbox for the layout and media queries for responsive behavior. Below is a sample code:
HTML
<div class="container"> <div class="copyright">© nikhil.com • 2024</div> <img src="johnstonhighschool.png" alt="Johnston High School Logo" class="logo"> <b class="blurredText">Nikhil LOLOLOL</b> </div>CSS
.container { display: flex; justify-content: space-between; /* Distribute space evenly */ align-items: center; /* Align items vertically to the center */ width: 100%; /* Full width */ } .logo { max-width: 100%; /* Ensure image is responsive */ height: auto; /* Maintain aspect ratio */ } .blurredText { filter: blur(2px); /* Apply blur */ } /* Mobile Styles */ @media (max-width: 600px) { .container { flex-direction: column; /* Stack items vertically */ align-items: center; /* Center items */ } .copyright, .logo, .blurredText { margin: 10px 0; /* Add margin for spacing */ } }Explanation
-
Flexbox Layout: The
.containerclass is set to use Flexbox withdisplay: flex;.justify-content: space-between;places the copyright text on the left, the logo in the center, and the blurred text on the right. -
Responsive Design: The media query
@media (max-width: 600px)applies styles for screens smaller than 600 pixels. Inside this media query, we change theflex-directiontocolumn, causing the items to stack vertically instead of horizontally. We also center-align the items and add margin for spacing. -
Blur Effect: The
.blurredTextclass applies a CSS filter to create a blur effect on the text.
You can customize the styles (e.g., colors, margin sizes) further to fit your design needs.
-