What methods can I use to achieve a stylish and responsive design for my images?

I have been encountering difficulties styling the images for my website. Despite multiple attempts, I am unable to apply CSS properties such as border-radius and responsive design to the images on my page. The images load fine, but they do not seem to accept any styling.

Update: In response to a request, I have now included the entire code snippet for the page. Can someone help me figure out how to round the borders of my photos and align them in the center without using classes? Any assistance would be greatly appreciated.

/* Add a background color with some padding to the body */

body {
  background: #383F51;
  font-family: Geneva, sans-serif;
}

/* Header and Blog Title */

header {
  background: #91c7b1;
  margin-top: 15px;
  padding: 5px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  text-align: center;
}

header h1 {
  font-size: 42px;
  font-family: "Electrolize", sans-serif;
}

header p {
  font-style: italic;
  font-size: 24px;
}

/* navbar/*
/* top navigation bar style */
nav {
  background-color: #000;
  overflow: hidden;
  display: block;
  height: auto;
  width: auto;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

/* navigation bar links */

nav a {
  float: left;
  color: white;
  text-align: center;
  font-size: 20px;
  padding: 10px;
  margin-left: 5px;
  text-decoration: underline;
  font-family: "Electrolize", sans-serif;
}
/* Create two unequal columns that floats next to each other */
/* Left column */
.rightcolumn {
  flex: 1;
}

.leftcolumn {
  flex: 5;
}

/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top of each other instead of next to each other */
.row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;}

main > .row {
  display: flex;
}

@media screen and (max-width: 800px) {
  main > .row {
    flex-direction: column;
  }
}

/* images (work in progress at the moment) */

/* Post layout for articles and additional areas */
.post {
  display: block;
  background-color:white;
  padding: 20px;
  margin-top: 10px;
  border-style: solid;
  border-color: #91c7b1;
  border-radius: 20px;
}
article h2, article h2 a, .post h2 {
  font-size: 24px;
  text-decoration: none;
  color: #533A71;
}

article h5{
  font-size: 16px;
  
}
.post p {
  line-height: 1.5em;
  font-size: 16px;
}
img {
  display: block;
  border-radius: 20px;
  max-width: 100%;
  height: auto;
}

ul {
  line-height: 25px;
  font-size: 18px;
  font-style: italic;
  list-style-type: none;
  padding: 0;
  
}
ul li:not(:last-child) {
    margin-bottom: 10px;
}
/* Footer */

footer {
  color: black;
  margin-top: 10px;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: #91c7b1;
  text-align: center;
  font-size: 18px;
  border-radius: 20px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta charset="UTF-8">
  <title>Project Incredible Indie Games</title>
  <link rel="stylesheet" href="style.css">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Electrolize&display=swap" rel="stylesheet">

</head>

<body>
  <!-- Begin Header -->
  <header role="banner">
    <h1>Incredible Indie Games</h1>
    <p>Reviews and Reccomendations for the Moderate Indie Gamer</p>
    <!-- End Header -->
    <!-- Begin Navigation -->
  </header>
  <nav role="navigation">
    <a href="index.html">Home</a>
    <a href="about.html">About</a>
    <a href="Ori-and-The-Blind-Forest.html">Reviews</a>
    <a href="Contact-form.html">Contact</a>
  </nav>
  <!-- End Navigation -->
  <!-- End Header -->
  <!-- Begin Main Content -->
  <main role="main">
    <div class="row">
      <!-- Begin Blog Posts -->
      <section class="leftcolumn">
        <article class="post" role="article">
          <h2> <a href="Ori-and-The-Blind-Forest.html">Ori and The Blind Forest: A Soulful and Stunning Action-Platformer</a></h2>
          <h5><time datetime="2021-09-22">Sep, 22 2021</time></h5>
          <figure>
            <img src="ori-and-the-blind-forest.jpg"  alt="Ori and The Blind Forest Game Cover" aria-label="Ori and The Blind Forest Game Cover">
            <figcaption>Ori and The Blind Forest Game Cover </figcaption>
            </figure>
          <p>Ori and the Blind foret tells a story of courage, love, and sacrifice through a beautifully displayed and fluid Metroidvania style platformer. Click on this article's title to see what makes this game such an enjoyable experience!</p>
        </article>
        <article class="post">
          <h2>Ori and The Will of the Wisps</h2>
          <h5>Sep 23, 2021</h5>
          <p>This sequel to Ori and the Blind Forest both builds on the story of the previous game and expands gameplay by including new skills and weapons. Depite the improvement, this game keeps the charm of Ori and is sure to please any fan.</p>
        </article>
      </section>
      <!-- End Blog Posts -->
      <!-- Begin Sidebar -->
      <aside class="rightcolumn" role="complementary">
        <section class="post">
          <h2>About Me</h2>
          <p>Well hello there, my name is Abby Lake and I humbly welcome you to 'Project Incredible Indie Games'</p>
          <p> To learn more, please click on the 'about' tag on the upper navigation bar </p>
        </section>
        <section class="post">
          <h2>Upcoming Posts</h2>
          <ul>
            <li> Endless Ocean </li>
            <li> Endless Ocean: Blue World </li>
            <li> Rime </li>
          </ul>
        </section>
      </aside>
      <!--End Sidebar -->
    </div>
  </main>
  <!--End Main -->
  <!--Begin Footer-->
  <footer class="footer" role="contentinfo">
    <p>Blog Created by: Abby Lake</p>
  </footer>
  <!--End Footer-->
</body>

</html>

Answer №1

If your current styling is working well, you may consider creating a separate class for the image with the following style:

.img-article {
display: block;
border-radius: 20px;
max-width: 100%;
height: auto;
}
<img class="img-article" src="ori-and-the-blind-forest.jpg"  alt="Ori and The Blind Forest Game Cover" aria-label="Ori and The Blind Forest Game Cover">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Which component from the Bootstrap library would be best suited for my needs?

I am looking to create a basic 6-page website. Here is the code for my main page: <html> <style> .ali{ width:170px; text-align:center; } footer{ background:#333; color:#eee; font-size:11px; padding-top: 25px; p ...

Incorporating Sass into an HTML document

Recently, I discovered Sass and went through its documentation. I successfully installed the package on my Ubuntu system alongside Ruby and Haml. Now I'm eager to learn how to use it with Wordpress or a basic HTML file. Being new to this, I'm see ...

How can you use only CSS (without jQuery) to hide a div and display another?

Is there a way to keep Collapse 2 directly under Collapse 1 when Content 1 is displayed? I attempted to reorganize the code, but it resulted in chaos. :D .collapse{ cursor: pointer; display: block; background: #cdf; } .collapse + input{ displa ...

Having trouble with the width:auto attribute in IE7?

CSS #wrapper .tn{ width:auto; height:20px; line-height:20px; float:left; padding:5px 2px 5px 5px; margin:0 5px 10px; font-weight:bold; background:#f0f0f0; } HTML <div id="wrapper"> ...

Optimizing HTML5 metatags and styles for a mobile application

As a C++ developer who has recently delved into using HTML5 for my mobile applications, I am in need of guidance when it comes to fine-tuning my meta tags. While I do have some knowledge in web programming, there are still gaps in my understanding. I am s ...

Tips for implementing jQuery on a CSS selector's :before pseudo-element

My dilemma involves creating a div using CSS with an added X at the top-right corner using the before pseudo-class. How can I implement a function to close this div by clicking on the X with the assistance of javascript? https://i.sstatic.net/Z5uSq.png C ...

What is the best way to arrange two divs inside a main div so they remain fixed in place at all times?

Struggling with aligning two smaller divs within a main wrapper for my website. Despite confining them to the main div, they don't stay fixed or aligned properly. How can this issue persist even when contained within a main div? I've attempted s ...

Populating a Listview in jqueryMobile with dynamic elements

I am struggling with my listview. Whenever I try to add or remove items from the list, the jquery mobile styling does not get applied to the new content that is added. <ul data-role="listview" id="contributionList"> <li id="l1"><a>5. ...

Understanding Node.js document object

Hey, I'm currently trying to execute a JavaScript function on the server side using node.js, but I've encountered an issue. The function relies on accessing hidden values within the returned HTML using the document DOM, however, the document obje ...

Ways to establish a minimum height for material cards using Material UI

I am facing an issue with a card that contains a nested table. The card expands and shrinks based on the size of the table inside it. I want to prevent the card from shrinking when the table has no data or just one entry. Instead, I need the card to mainta ...

Excessive spacing in the <td> elements - TABLE

I am encountering some problems with my table layout. The spacing between the field names and text boxes appears to be too large. Could there be mistakes I'm making that are causing this issue? How can I minimize the gaps? Please refer to the image b ...

Exploring the integration of PostgreSQL into JavaScript

As a beginner in JavaScript, I am looking to create a web page that can store data in a database. Can anyone provide guidance on what resources or materials I should study to learn more about this process? ...

Suggestions for arranging nested list items securely?

Hello, I'm new to web design and would greatly appreciate any assistance. I've been learning HTML and CSS through a live project but have run into trouble with positioning nested list items. This is how my web browser renders the page: Here&a ...

Leveraging HTML tables for input purposes

Just starting out with php, HTML, and mysql. Using HTML tables for the first time here. Created an HTML table filled with data from a MySQL table. Planning to use this table as a menu where users can click on a cell with a specific date. The clicked date ...

Conceal the href element within a designated UL using JavaScript

Is there a way to only hide the href element in a specific UL element, rather than hiding all href elements with the same class name? Let's consider an example HTML code: <ul class="UL_tag"> <li>Text 1</li> <li>Text 2< ...

Guide to periodically updating and displaying a <b-img> element in VueJS

Recently delving into the world of JS and Vue. Within my Bootstrap-Vue project, there's an image element that looks like this: <b-img src="/api/camera" fluid alt="camera"></b-img> Whenever the page is refreshed, the br ...

Conceal dynamically generated divs based on their individual class identifiers

My task involves dynamically generating div elements with incremented class names. Each div contains a close button in the top right corner, and I need to hide a specific div when the close button is clicked. Example Code: var i=1; var newImageBoxdiv = $ ...

Ways to incorporate vector .svg images into a D3js tree diagram

var treeData = [ { "name": "Top Level", "parent": "null", "remark":"yes", "children": [ { "name": "Level 2: A", "parent": "Top Level", "remark":"yes", "children": [ { "name": "So ...

jQuery is not active on responsive designs

I have implemented a script in my JavaScript code that changes the color of the navigation bar when scrolling. The navigation bar transitions to a white color as you scroll down. However, I am facing an issue with responsiveness and would like to deactivat ...

How can you eliminate a specific element from an HTML document?

Utilizing localStorage can be tricky when it comes to keeping the JSON file hidden from being displayed on the HTML page. One approach I used involves sending the JSON file to the client once and then performing all logic using that file. To prevent the JS ...