Skip to main content

How to Build a Dynamic Website from Scratch with WordPress FOR FREE

Are you looking to build a dynamic website from scratch without breaking the bank? WordPress is an excellent choice for creating a powerful and versatile website, and the best part is, it can be done for free. In this article, we will guide you through the step-by-step process of building a dynamic website using WordPress, without any coding knowledge required. Let's get started! Table of Contents Introduction to WordPress Setting Up Your Local Development Environment Installing WordPress Choosing a Theme Customizing Your Website Design Adding Essential Plugins Creating Pages and Navigation Setting Up a Blog Optimizing Your Website for SEO Enhancing Functionality with Plugins Securing Your Website Testing and Launching Your Website Maintaining and Updating Your Website Monetizing Your Website Conclusion 1. Introduction to WordPress WordPress is a popular content management system (CMS) that allows users to create and manage websites easily. It offers a user-friendly interface, a wi...

Centering an image with media queries when in mobile mode

Centering an image with media queries when in mobile mode

To center an image vertically and horizontally on a web page using CSS, you can use the following CSS code:

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* Adjust this value as needed */
}

.container img {
  max-width: 100%;
  max-height: 100%;
}

In this example, we create a container element with the class name "container" that will hold the image. The container is styled as a flex container using display: flex, which allows us to use flexbox properties for alignment.

center mobile


The justify-content: center property horizontally centers the image within the container, and align-items: center vertically centers the image. The height: 100vh sets the height of the container to 100% of the viewport height, but you can adjust this value as needed.

The img selector inside the container sets max-width: 100% and max-height: 100% to ensure the image doesn't exceed the container's dimensions.

To use this CSS, you need to wrap your image with a container element like this:

<div class="container">
  <img src="your-image.jpg" alt="Your Image">
</div>

Replace "your-image.jpg" with the actual path or URL of your image, and "Your Image" with an appropriate alt text for accessibility purposes.

With this setup, the image will be centered both vertically and horizontally on the page.

Comments

Popular Posts

Understanding next.js useRouter

Understanding next.js useRouter Next.js is a popular framework for building React applications. It provides many features that make developing web applications easier, including client-side routing. One of the key tools in Next.js for handling routing is the  useRouter  hook. In this article, we will explore what  useRouter  is and how it can be used effectively in Next.js applications. 1. Introduction to useRouter The  useRouter  hook is a built-in hook provided by Next.js. It allows us to access and manipulate the current page's routing information. With  useRouter , we can extract data from the URL, handle dynamic routing, process query parameters, and perform page redirection. 2. Benefits of using useRouter Using the  useRouter  hook in Next.js offers several benefits: Simplified routing setup :  useRouter  simplifies the process of setting up routing in Next.js applications. It provides an intuitive interface for handling routi...