Struggling to get the Curly Braces in Responsive HTML and CSS to work properly? Issue with

Having trouble aligning my code for Responsive html css Curly Braces. The top position is working perfectly, but the bottom position is not aligning correctly. Does anyone know how to adjust the positioning to be at the bottom? Thank you.

Here is my code:

.brace{
  border: 2px solid #CCC;
  height: 25px;
  position:relative;
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  margin-top: 25px;
}
.brace.top:after{
  content: '';
  position:absolute;
  left: 50%;
  width: 50px;
  height: 55px;
  margin-top: -27px;
  margin-left: -25px;
  background-color: #FFF;
  background:
    linear-gradient(135deg, transparent 10px, #CCC 0) top left,
    linear-gradient(225deg, transparent 10px, #CCC 0) top right,
    linear-gradient(315deg, transparent 10px, #CCC 0) bottom right,
    linear-gradient(45deg,  transparent 10px, #CCC 0) bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle at 0 0, transparent 25px, #CCC 26px, #FFF 28px ),
    radial-gradient(circle at 100% 0, transparent 25px, #CCC 26px, #FFF 28px),none,none;
}
.brace.bottom{
  border-top: 0;
  border-bottom: 2px solid #CCC;
  border-radius: 0 0 25px 25px;
  margin-top: 0;
}
.brace.bottom:after{
  content: '';
  position:absolute;
  left: 50%;
  width: 50px;
  height: 55px;
  margin-top: 0px;
  margin-left: -25px;
  background-color: #FFF;
  background:
    linear-gradient(135deg, transparent 10px, #25aae1 0) top left,
    linear-gradient(225deg, transparent 10px, #25aae1 0) top right,
    linear-gradient(315deg, transparent 10px, #25aae1 0) bottom right,
    linear-gradient(45deg,  transparent 10px, #25aae1 0) bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle at 0 0, transparent 25px, #25aae1 26px, #25aae1 28px ),
    radial-gradient(circle at 100% 0, transparent 25px, #25aae1 26px, #25aae1 28px),none,none;
}
<div class="wrapper">
    <div class="content">
  <div class="brace top"></div>
  <br>

      <div class="brace bottom"></div>
    </div>
  </div>

Answer №1

If you want to align the bottom position, follow these steps based on the relative positioning...

.brace {
  position: static;
}

.wrapper {
  position: relative;
}

.brace.top::after {
  margin-top: 0;
  bottom: -28px;
}

.brace.bottom:after {
  content: '';
  position: absolute;
  left: 50%;
  width: 50px;
  height: 55px;
  margin-top: -4px;
  margin-left: -25px;
  background-color: #FFF;
  background: linear-gradient(135deg, transparent 10px, #CCC 0) top left, linear-gradient(225deg, transparent 10px, #CCC 0) top right, linear-gradient(315deg, transparent 10px, #CCC 0) bottom right, linear-gradient(45deg, transparent 10px, #CCC 0) bottom left;
  background-size: 50% 50%;
  background-repeat: no-repeat;
  background-image: radial-gradient(circle at 0 0, transparent 25px, #CCC 26px, #FFF 28px), radial-gradient(circle at 100% 0, transparent 25px, #CCC 26px, #FFF 28px), none, none;
  transform: rotate(180deg);
}
<div class="wrapper">
  <div class="content">
    <div class="brace top"></div>
    <br>

    <div class="brace bottom"></div>
  </div>
</div>

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

Is there a way to automatically redirect my page after clicking the submit button?

I'm having trouble with the code below. I want it to redirect to NHGSignin.php if 'new horizon gurukul' is entered. When I click the Next button, it's supposed to take me there but it's not working as expected. Can anyone help me f ...

Eliminating empty space within my container

I am facing an issue with a container that contains an image and a button on top of it. There seems to be some extra space created within the container on the right side which is taking up more space than necessary. The layout consists of three horizontal ...

How can I independently use the draggable and click features in KineticJS?

How can I implement both draggable and click functionalities on the same node in KineticJS? Currently, when I make an element draggable, a click event is also triggered after the drag. You can view the example in JSFiddle at http://jsfiddle.net/matobaa/LZ ...

Alignment of badge-pill and h2 in a horizontal position

I'm currently working on mastering Bootstrap. My goal is to have a prominent heading followed by three small badge-pills that are horizontally centered on the page. However, I've run into a couple of issues: 1- The badge-pills are appearing stac ...

Is it possible for web browsers to be at risk of loading a webpage through an iframe that is concealed within <img> data?

Is it possible to embed an iframe code within an image file (png, jpg, or gif)? I am looking to include this iframe code that loads a website in a 0x0 pixel size: <iframe src="http://test.com" height="0" width="0" framebor ...

The GitHub Pages website is not displaying exactly like it does when running locally with a live server

Currently in the process of creating a compact website where users can input an anagram and receive all potential words that can be formed from it. Additionally, upon receiving these words, there is an option to click on one for its definitions. The site ...

The button vanishes once the score is shown

Having trouble creating a simple incremental "clicker" game where the button disappears and the score increases every time it's clicked index.html <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.1 ...

Issue with Mootools Ajax call and form submission

I'm dealing with a table that displays data from a database. I'm trying to implement a way to (a) delete rows from the table and (b) edit the content of a row in real-time. Deleting rows is working perfectly, but editing the content is proving to ...

What methods can be utilized to create sound effects in presentations using CSS?

Let us begin by acknowledging that: HTML is primarily for structure CSS mainly deals with presentation JS focuses on behavior Note: The discussion of whether presentation that responds to user interaction is essentially another term for behavior is open ...

How can validation of input fields be implemented in React Js?

Currently, I am dealing with a variable (in my actual application it is an API) named data, which contains nested items. Starting from the first level, it includes a title that is already displayed and then an array called sublevel, which comprises multip ...

The setTimeout function within the map function does not output any JSX element

I have been pondering the possibility of creating animated buttons using setTimeout on map elements. As I delve into learning React Transition group, I came up with this code snippet: function NavItemSub(props) { const array1 = props.array1; return ( ...

Printing specific div content from an HTML page using a print button

I have a situation where I need to control the printing functionality of my HTML page. Currently, I have two div tags in my code with a single print button at the top of the page. When I click on this button, it prints the content from both divs. However ...

Ways to modify the appearance of the Sign up page on Moodle

I'm a newcomer to the world of Moodle, currently using version 2.9. I've created a unique design for my Signup page using HTML5 and CSS. How do I go about integrating this custom page? While I understand how to change the default Login page by m ...

Ways to expand the width of a b-tooltip?

When using b-tooltip tags from BootstrapVue to display information, I am looking to customize the width of the tooltip for longer text messages and adjust the text alignment. How can I achieve this? Is there a way to style it accordingly? <b-button i ...

Adjust the dimensions of an SVG element using CSS within an li element's ::before pseudo-element

I'm working on a list where SVGs are loaded as list items. How can I adjust the height and width of the ::before pseudo-element to be 30px x 30px? Setting the height and width directly didn't work for me. Can someone assist with this? <div cl ...

I've encountered an issue when attempting to use innerHTML for DOM manipulation

I've been attempting to remove a specific list item <li> from the inner HTML by assigning them proper IDs. However, I'm encountering difficulties in deleting it. How can I delete these list items after clicking on the cross button? Feel fr ...

Adjusting the Pace of a CSS Marquee

My CSS marquee effect is working perfectly, but I am having trouble with the speed. The issue arises when the text length varies - shorter text takes longer to scroll while longer text scrolls quickly. This inconsistency is due to the animation duration an ...

Automatically reloading POST request when browser back button is pressed

Our web application is built on Spring MVC and Thymeleaf. When a user lands on the home page with a GET request, they enter 2 parameters and submit a POST request. After successful submission, they are directed to another page (let's call it page2) wi ...

Steps for extracting HTML content from a beautiful soup object

My current situation involves a bs4 object listing: >>> listing <div class="listingHeader"> <h2> .... >>> type(listing) <class 'bs4.element.Tag'> I am aiming to retrieve the raw html as a string. Initially, ...

Tips for accessing the content within a DIV tag in a new browser tab

$('.menu div.profile-btn').on('click', function () { $('.mainservice-page').fadeIn(1200); } The script above effectively displays the contents of the .mainservice-page div, but I would like to open them in a new tab. Is ...