The image is refusing to adjust according to CSS settings

Why won't the image adjust to the CSS? I'm trying to move the picture to the side a bit by adding margin, but it's not working out. Any ideas?

HTML




  
<div class="la">
  <center>
    <h1> GREET THE TEAM </h1>
  </center>
</div>

<img class="pic" src="duve.png">

</body>

</html>

CSS

.pic {
  height: 500px; 
  width: 250px;
  margin: 50px;
  border: 5px solid black;

}

Any suggestions on how to position the picture slightly to the left side? I've tried various options without success.

Answer №1

Have you made sure to link your CSS file with the HTML file you're currently working on?

For instance, if your CSS file is named style.css, you should include the following line within the <head> tag of your HTML file:

<link rel="stylesheet" href="style.css">

Update: Pay attention to the location of both your HTML and CSS files. If they are stored in different directories, make sure to adjust the href accordingly.

For example, if the style.css file is located higher up in the file hierarchy than the HTML file, then the href should be href="../styles.css"

Answer №2

It is recommended to utilize: margin-left: 50px rather than margin: 50px, as using margin:50px will result in a 50px gap on all sides of the image.

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

Vue.js component communication issue causing rendering problems

When it comes to the Parent component, I have this snippet of code: <todo-item v-for="(todo, index) in todos" :key="todo.id" :todo="todo" :index="index"> </todo-item> This piece simply loops through the todos array, retrieves each todo obj ...

Problem with Adjusting Bootstrap Carousel Caption Placement per Slide

Trying to customize the position of each Bootstrap Carousel slide in This Demo. The code snippet below modifies the caption positioning: .carousel-caption { top: 0; bottom: auto; } However, I need to adjust the positions of other slides' ca ...

Using a Jquery selector with either the ID Regex or a repetitive class

There is a collection of similar elements with matching IDs Below are two methods for selecting them using Jquery: Select by ID + Regex (For example, How can I select an element by ID with jQuery using regex?) Add a redundant class to all the elemen ...

What is the best way to merge two objects in a JSON array and separate them with a comma?

Hey there, I could use some assistance with formatting a code snippet. I have written JavaScript code to parse JSON data which includes latitude and longitude information: const api_url = 'json.php' async function getjsonlatest() { const resp ...

Learn how to incorporate a consistent header and footer across multiple pages on a website with Node.js, ExpressJS, and either hbs or ejs templates

Creating a common header (navbar) and footer page to be included in multiple/several pages of a website. I want to create a dynamic website using Node.js and Express.js. The code for the navbar and footer will be placed in a common file named header.html ...

Location of the html header navigation bar and main content area

Seeking assistance with HTML, CSS, and Bootstrap. I'm trying to create a template for my website that includes a top header, a side navigation bar, and a main section. However, I am struggling to position these elements correctly. The side navbar is a ...

Utilizing CSS to style the disabled selection in the absence of an optgroup

I am encountering an issue with a select component that has grouped options and a default option. The CSS styling is not being applied to the option without a group. I would like to change the color of the hidden disabled option to match the placeholder. ...

`Loading CSS files in Node.js with Express``

My CSS isn't loading properly when I run my HTML file. Even though the HTML is correctly linked to the CSS, it seems like express and node.js are not recognizing it. I find it confusing to understand the articles, tutorials, and stack overflow questio ...

Creating a table that adjusts its columns to match the same width percentages for a responsive design

Three tables were created with identical column names. The HTML markup for each table is consistent. When viewed on a laptop browser, the tables display correctly as depicted in this screenshot: https://i.sstatic.net/5BAdg.png However, when viewed on a s ...

When attempting to input data into the database, an error is displayed stating that /test.php cannot be POSTed

Every time I try to input data using PHP, it throws an error Cannot POST /test.php. I've been attempting to fix it with no success. Can anyone please help me solve this issue? It's crucial for my project work. Here is my HTML code: <html> ...

Chrome clipping positioned spans

Having trouble positioning a label above inline sections with spans in Chrome, as the labels are getting clipped oddly. Check out these screenshots: Firefox view: Chrome view: In the Chrome screenshot, you can see that the labels are being cut off based ...

Tips for increasing the size of a parent div when a child div is displayed with a set width?

Is there a way to make the parent div automatically expand when the child div with a fixed width is displayed onclick? Goal: I want the child div to show up when I click the link, and at the same time, I need the parent div to expand or scale to fit the ...

Functionality of local data storage

I'm currently exploring the capabilities of the localStorage feature. Let's say I have a large JSON object stored using localStorage. I need to share this data with the testing team for review. However, if I try to display the stored data on an H ...

What is the term used for a tag that automatically closes itself?

Within tag-based languages such as HTML or XML, there are tags that automatically close themselves without the need for a separate closing tag: <tag/> As opposed to the traditional method of closing tags like this: <tag></tag> Do thes ...

Display the html content within a <div> element by leveraging the power of jQuery

Can someone help me with displaying the HTML contents from a dropdown menu button link to a <DIV>? I would appreciate if you could provide a sample page for reference. Thank you in advance :) ...

The CSS file that is defined first in the node.js HTML is the only one being utilized

Currently, I am incorporating CSS and JS files into my node.js/express application with the help of the ejs templating engine. Interestingly, while the JavaScript files are being successfully implemented, only the first included CSS file seems to be affect ...

Is there a way to customize the background color when the Bootstrap 4 toggle switch is in the "checked" position?

I'm struggling to find a way to adjust the background color of the "checked" state for this toggle switch in Bootstrap 4. It utilizes an additional library for toggling between dark and light modes - you can find it here on github. While that function ...

"Clicking on the dropdown menu fails to trigger it to open

The dropdown menu within the navbar fails to open when clicked. Here's a snippet of the HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-wid ...

Is there a way to customize the mark style in Bootstrap?

I've gone through numerous articles on this issue, but I'm still unable to resolve it. My goal is simply to eliminate the padding that bootstrap automatically adds around the mark tag. This is important because I am dynamically changing highlight ...

Ways to incorporate a background image using CSS

I tried to add a background image using CSS, but unfortunately, I was unsuccessful in my attempts. body { font-family: Arial, Helvetica, sans-serif; } /* .login-form{ width: 400px; } */ /* Full-width input fields */ input[type=text], input[type ...