What is the deal with this boundary?

Recently, I was experimenting with CSS borders and came up with this interesting result:

border-style: double dashed dashed solid;

I am curious to understand why it produces such an effect. Adjusting the border-width seems to have unexpected consequences as well.

If you want to take a look, here is the link to the JSBIN code snippet: JSBIN

Answer №1

When you use

border-style: double dashed dashed solid;
, you are setting the border style for all sides of the border simultaneously. Think of it as
border-style: <top> <right> <bottom> <left>;
, making it a shortcut for:

border-top-style: double;
border-right-style: dashed;
border-bottom-style: dashed;
border-left-style: solid;

Answer №2

If you want to achieve a unique design using CSS, consider implementing solid borders on the bottom, right, and left sides, while doubling up on the top border. This creates an interesting visual effect similar to having a metal frame around an image that is rounded at the corners. Take a look at the examples below for inspiration:

  1. Example with solid borders:

background: none repeat scroll 0 0 gray;
border-color: red;
border-radius: 0;
border-style: double solid solid solid; // top, right, bottom, left
border-width: 15px;
height: 150px;
width: 150px;

To round off the borders, simply adjust the border-radius property to 50%:

  1. Rounded borders example:

    border-radius: 50%;

If you add an inset style to the top border, it will create a different look:

border-style: inset solid solid solid; // top, right, bottom, left

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

Tips for displaying only one image when clicked and hiding other divs:

Currently tackling a project that involves JavaScript and I've hit a roadblock. Before you dive into the text, take a look at the image. Check out the picture here. I have successfully created a slider, but now I want to implement a feature where cli ...

Why won't my browser properly center my CSS navigation menu?

After experimenting with different CSS properties like margin-right: auto and margin-left:auto, I found that using display: inline-block works well for centering actual links, but it causes issues with the menu when added as a parent element. I suspect th ...

CSS inline-block problem - Either everything stays or everything collapses

I am facing a specific scenario where I have three inline-elements. Two of them are essentially the same, but the one in the middle has an unknown width. I want to achieve one of two things: Have all three elements display inline on the same row If the ...

Options for Repeating and Full Width Custom Headers in WordPress

I have been exploring the WP codex extensively, but without success. I have enabled the customizer custom header and can upload images. I can then set some CSS to choose whether I want it to be full width or repeated. However, I would like to add an option ...

Error: Definition Already Exists

I'm currently debugging a layout and encountering some peculiar errors. The page is being served as DTD XHTML 1.0 Strict. The error message looks like this: ID "OFFICENAME" already defined: div class="office" id="officename" ID "OFFICENAME" origin ...

Image positioned above the text in the mobile layout following the text

Can the layout be adjusted so that on desktop, the image is on the right and text on the left in the lower box, but on mobile, the image appears above the text? https://i.sstatic.net/hbPxa.png I understand that placing the image tag after the text tag in ...

Can the loaded image from the css sprite be displayed on the screen?

My webpage is designed to load two images from a CSS sprite using the following code: <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div class="arrow low"></div> ...

dynamically adjust table cell width based on number of rows

My HTML structure is as follows: <table border=1 > <tr> <!--this tr has one <td> that needs to be 100% width--> <td></td> </tr> <tr> <!--this tr has two <td> that each need to be ...

Creating a secondary menu below the navbar using Bootstrap 3's nav-pills component

Is it possible to create a secondary menu using Bootstrap 3 with nav-pills that behaves like a secondary navbar? Check out this video tutorial Here is the HTML code for my menu: <div class="row"> <div class="col-md-12"> <ul class="n ...

Color Swap Hover Animation

I need help implementing a color switch on hover, but I'm facing an issue where the text (within a span) is within a list item. Currently, the color changes only when hovering over the text itself, but I want it to change when hovering over the entire ...

IE6 disrupts stored layouts

I've encountered a strange issue with my design in IE6. It loads perfectly at first, but after reloading it a couple of times, everything suddenly collapses. The strange part is that when I upload an updated version, it fixes the issue, only to break ...

How can I make one background image extend beyond the grid when there are two background images?

I am currently working on a website design using the 960 grid system and a responsive framework called 'skeleton'. Everything is running smoothly, but I have encountered a problem with the header banner. Since it is only 960px wide, there are whi ...

Using Star ratings in amp CSS with Django template Tag: A complete guide

I need to implement a star rating display on amp pages based on values retrieved from the database using django template tags. How can I achieve this considering the ratings are in float format? Additionally, is it possible to apply the same code to non-am ...

Failing to verify the presence of specific text within a dropdown menu using Selenium

Previously, I successfully implemented this code, however, the HTML/CSS for the dropdown has since changed and now I am unable to get it to function correctly. Below is the structure for the dropdown code, with specific text highlighted that I am trying t ...

Troubleshooting a problem with CSS animations disappearing

I've been experimenting with CSS animations and I've run into a bit of a snag. I'm looking to create a div that fades in with a delay - meaning it won't be visible until the animation starts. Here's what I have so far: http://jsfi ...

Transfer the background-image from one div to another

I have several div elements that act as buttons, each with a different background image set in the CSS file: #button1 { background-image: url('../images/abc.png) } #button2 { background-image: url('../images/def.png) } #button3 { background-imag ...

The content within the bootstrap card is not displaying correctly in its entirety

The alignment of the '.card-text' within my row of bootstrap cards is not correct. I attempted to adjust the spacing for '.card-text', but unfortunately, it did not resolve the issue. Below is the code snippet: HTML: <!DOCTYPE html& ...

What could be causing the span tag to not have CSS applied and the background image to not be displaying

The header I have created, shown in the image, is facing two issues. Firstly, I am unable to add ellipsis to the span tag even though I used it. I want the ellipsis to appear when the screen resolution is small. Secondly, the image uploaded is not displayi ...

Maintain the state of the toggle div after page refresh or modification

In this scenario, I am looking to ensure that my div remains open even if the page is changed or refreshed. Below is the HTML and JavaScript code provided: You can view the working code here: http://jsfiddle.net/wasimkazi/fauNg/1/ $(".widget2").hide( ...

Is there a way to make this animation activate when the entire area in front of the link is hovered over or tapped?

I am working on an animation that needs to run behind a link. Here is an example: https://codepen.io/ehbehr/pen/KKNbOvN and below is the HTML and CSS: *, *:before, *:after { margin: 0; padding: 0; } .container { position: relative; width: 100%; ...