Curved edges on pictures

http://jsfiddle.net/48Y37/

I'm trying to achieve rounded corners on both ends of the top of an image, but the image itself is covering them up. I've searched online and found suggestions like using overflow: hidden; or even resorting to JavaScript (which I'd rather avoid), but I haven't been successful in integrating these solutions into my existing code.

Any help would be greatly appreciated.

<section class="container">
    <header>
        <img src="http://i.imgur.com/CpL8u.png" style="box-shadow: 0px 0px 10px #888;" />
    </header>
    <section class="body">
        Lorem ipsum blahblah I don't know the rest.
    </section>
</section>

CSS:

header {
    width: 640px;
    margin-left: -10px;
    margin-top: -10px;
}
section.container {
    background: #fff;
    width: 620px;
    margin: auto;
    -moz-border-radius: 10px;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0px 0px 20px #888;
}
section.body {
    margin-top:10px;
}

Answer №2

To create a rounded image, you need to ensure that the <img> tag's class includes the border-radius property. For instance:

<img class="rounded-image" src="/your-image-source.png">

The CSS for this would be:

.rounded-image {
border-radius: 15px;
}

Answer №3

  1. Take a snapshot of the image using Snipping Tool and paste it into Paint.
  2. Select the Rounded Rectangle tool and adjust the color to white.
  3. Opt for the largest size when creating the rectangle.
  4. Add a white rounded border around the image.
  5. Finally, duplicate and insert the rounded image wherever you want.

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

React: Submit button not triggering form submission despite having a valid submit event handler and correct syntax

My question stands out from existing ones as it features valid syntax, correct use of type="submit" on the button, and a simple onSubmit handler on the form. Despite this, clicking the button fails to trigger the onSubmit handler. To illustrate ...

Gleaming R: Warning prompt or modal box input: invalid

In the process of developing a basic application, I am seeking to implement a pop-up notification for invalid inputs. By referencing the suggestion provided in #1656, I have come up with an example that introduces a visually appealing background color when ...

Tips for aligning an image list marker for perfect vertical text centering

When using the CSS property list-style-image, how can I align the 'A' words in the image to the center of the check marks? ...

"Enhancing Your List Design: Customizing CSS for Hover Effects on Images

I'm currently working on a CSS/HTML list that utilizes an image as the background and changes to a different image when hovered over. However, I've encountered an issue where the hover image is not aligning properly, leaving a noticeable gap. T ...

What could be causing the error.status value to not be displayed on my Embedded Javascript (EJS) page?

Currently utilizing ejs, node.js & express along with other packages I'm facing an issue where the error.status and error.stack values are not appearing on the rendered page. I suspect that the error variable may be undefined or inaccessible within t ...

What is the best way to differentiate between several elements inserted via JavaScript in my HTML code?

I'm attempting to replicate the image below using HTML and JavaScript: https://i.sstatic.net/kvmqk.jpg So far, this is what I have: https://i.sstatic.net/8iHfB.png Here's my JavaScript code: function createLink(text, parentElement) { var ...

position property in div element disrupts slider functionality

I've been working on incorporating a simple slider into my website and stumbled upon this example on jsfiddle My goal is to have the slider positioned "relative" within my site, but when I change the CSS to position: relative;, the slider no longer ...

Media queries in CSS appear to be dysfunctional when used on Microsoft Edge

@media (min-width: 992px) and (max-width: 1140px) { .mr-1024-none { margin-right: 0px !important; } .mt-1024 { margin-top: 1rem !important; } .d-1024-none { display: none !important; } } Utilizing the ...

Prevent event propagation in jQuery by using .stopPropagation() when hovering over a

When trying to implement event.stopPropagation() in a specific scenario, I encountered an issue with a blinking background image on my submenu. To address this, I added a pseudo-element (background:green) to the parent element by toggling a new class using ...

Is it possible to include multiple classes in the `not()` selector in CSS?

When trying to stack multiple classes in the not() selector using ,;:, it does not work as expected. input[type=text]:hover:not(.ui-pg-input .mandatory){ background-color: #D9EDF7;} What is the correct way to stack classes in the css not() selector? ...

The HTML button navigates to an incorrect form

I have developed a program that includes a section for user comments and another section where logged-in users can input their own comments. When a logged-in user writes a comment, they will see a delete button next to it. Clicking on this button should t ...

Video tag with centered image

For a current project, I am in need of rendering a centered image (a play button) at runtime on top of a video based on the UserAgent. If the userAgent is not Firefox, I want to display the image as Firefox has its own playEvent and button on top of the vi ...

Guide on creating an autonomous select-all checkbox to show table columns

How can I create checkboxes with a "Select all" option and the following functionality: Check one or more checkboxes to show specific table columns. Uncheck them to hide the columns (toggle). Select the "Select all" checkbox to display all table columns. ...

What is the best way to arrange 4 resizable divs in a horizontal layout?

I need to create a search feature with a specific layout: [Search Input (visible when search icon is clicked)] SearchIcon ClearIcon RefreshIcon All arranged in a horizontal layout. I have created a directive (called my-search) to combine the search inpu ...

Guidelines for retrieving a file from Amazon S3 through a web browser utilizing Python (and boto) on Google App Engine

I have a Python program running on Google App Engine using boto 1.9b that retrieves all keys from an S3 Bucket and formats the output into an HTML table. bucket_instance = conn_s3.get_bucket(bucketname) liste_keys = bucket_instance.get_all_keys() table = ...

How to Trigger a Validation Error on an HTML Template Using Django

I'm encountering an issue with displaying a validation error message on my HTML template when the form is not submitted correctly. In my forms.py file, there is a function (clean_email) that successfully identifies if the email entered does not contai ...

I am encountering a horizontal scroll bar despite setting the width to 100%

I am just starting out as a beginner in web development. I decided to create a webpage to practice my HTML and CSS skills. However, when I set the width of all elements to 100%, I noticed that I am getting a horizontal scroll bar. I have tried troubleshoot ...

display child element at full width within a parent element that is not full width

I have a container with a maximum width of 1024px, and I want one of its child elements to take up 100% width starting from the left edge of the screen. Is there a way to achieve this without adding extra HTML markup? I know I can make the child element 1 ...

Discovering the window.scrollTop, ScrollY, or any other distance value while utilizing CSS scroll snap can be achieved by following these

I am currently utilizing css scroll snap for smooth scrolling through sections that are 100vh in height. The functionality of the scroll snap is quite impressive. However, I need to find a way to determine the exact distance the user has scrolled down the ...

Utilize jQuery to locate and remove entire rows containing cells with specific text

Currently, I am exploring table manipulation with jQuery. My objective is to scan an entire column based on its header to identify specific values. Once these values are identified, my goal is to delete the entire row containing that value. At this point, ...