Responsive CSS styling for obtuse-angled triangles

Looking for some answers on this topic.

Is there a way to create a responsive obtuse-angled triangle using html/css or JS?

I am interested in creating a triangle similar to this example:

obtuse-angled triangle sample :

https://i.sstatic.net/6Mib4.png

I know how to make triangles using the border trick, but struggling with the obtuse-angled one.

Hoping for some clever suggestions from you all!

Best wishes Joachim

Answer №1

Check out this easy method to create a linear-gradient effect:

body {
  margin:0;
  height:100px;
  background:linear-gradient(to top right,transparent 50%, blue 51%) 0 0/20% 100% no-repeat,
  linear-gradient(to top left,transparent 50%, blue 51%) 100% 0/calc(80% + 1px) 100% no-repeat;
}

Answer №2

Create unique borders using varying widths

div {
  margin: 1em auto;
  height: 0;
  width: 0;
  border-color: red transparent transparent transparent;
  border-style: solid;
  border-width: 250px 250px 0px 50px;
}
<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

What causes the disappearance of values from an object upon clicking the button?

In my demonstration application, I am utilizing the following package: https://www.npmjs.com/package/mui-react-hook-form-plus This package has a dependency on react-hook-form After clicking a button, the object keys are mysteriously removed. I&ap ...

Incorporate dynamic interval transitions to the carousel rotation

I'm currently working on implementing a carousel with 'Next' and 'Previous' buttons that slide through images. However, I've been struggling to get the auto-slide feature to work at regular intervals. If anyone has any sugges ...

Express is having trouble retrieving the query parameter from the URL

Working with the express framework and react on the front end application to handle HTTP requests in a node app, I have the following method: app.get('/api/matches', async (req, res) => { console.log(req.originalUrl); // /api/matches/ cons ...

Is your console showing an error message about an incompatible IE Document Mode?

I am encountering an issue with the following code in my jsp page. <!--[if lt IE 7]><html lang="en" class="no-js lt-ie10 lt-ie9 lt-ie8 lt-ie7" xml:lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"> <![endif]--> <!--[if IE 7]>& ...

Is there a benefit to using the Angular LocalStorageModule alongside angular-cache?

To configure the angular-cache, follow this setup: app.service('myService', function ($angularCacheFactory) { // This cache will synchronize with localStorage if available. Upon each app load, it will attempt to retrieve any previously save ...

The Bootstrap form fails to function properly on mobile devices

On my Bootstrap form, everything works fine when entering data on the desktop version. However, I am facing an issue with the mobile version where I cannot input any information into the fields. The fields are unresponsive and not allowing me to enter an ...

JavaScript, duplicating elements on a webpage

For my web application, I am looking to generate multiple blocks with different content. Instead of creating all the elements on the server side, some need to be dynamically created based on user input. So far, I have considered two options for generating ...

Issue with Loading JQuery AutoComplete

Issue with Code Javascript Code using Jquery: $('[id$=Name]').autocomplete('CallBack.aspx',{formatItem: function(item){return item.Name;}}).result(function(event, item) { location.href = item.AGE; }); Json Data: ...

Exploring Bootstrap4: Interactive Checkboxes and Labels

My form design relies on Bootstrap, featuring a checkbox and an associated label. I aim to change the checkbox value by clicking on it and allow the label text to be edited by clicking on the label. The issue I'm facing is that both elements trigger t ...

Utilizing the keydown event in jquery with specific key restrictions

I want to prevent the page from refreshing when the user presses F5 or Ctrl+F5. I have come up with the following code to achieve this, but now whenever I press any key on the page, the function runs and prevents me from filling out textboxes or using ot ...

There seems to be an issue with the AngularJS ng-click function not functioning properly

I'm attempting to insert a link tag with a filter into an HTML content. The HTML content is bound using ng-bind-html and the link tag includes an ng-click directive. However, I'm facing an issue where the ng-click function is not functioning. He ...

The http service in AngularJS consistently generates errors

I have been facing an issue with my AngularJS http service where it consistently returns an error with status -1. My PHP code, located at localhost/ajax.php, is able to successfully retrieve data from the database. The retrieved data includes information s ...

"Occasionally, the PHP function for randomly selecting an image may result in

My function is supposed to open a specific directory, create an array of the image files within that directory, and then select a random image from the array to display on a webpage. However, there are instances where it fails to retrieve the image name. ...

What is the best way to utilize props in ReactJS to establish a condition that enables me to modify the state of my application?

Within my project, I have the "App" component serving as the parent and the Hero component which features an image along with left and right arrow functionalities. In order to achieve the desired functionality, I aim to utilize the right arrow to incremen ...

Having trouble with Node.js executing commands in the console

I've been following some tutorials on YouTube to learn how to create a real-time chat using Node.js from the phpacademy channel. Currently, I'm stuck at the step where I need to run my server.js file in the console. When I enter the command ...

You are unable to align a paragraph with a specific width in the center

I adjusted the width of a paragraph to make it less stretched out horizontally and more compact. However, when I attempted to center align the text within the paragraph using text-align: center;, only the direction of the paragraph was centered. The chall ...

One can only iterate through the type 'HTMLCollection' by utilizing the '--downlevelIteration' flag or setting a '--target' of 'es2015' or above

I'm currently working on developing a loader for my static grid. I've incorporated the react-shimmer-skeleton package source code, but I'm encountering issues with eslint in strict mode. You can find the respective repository file by followi ...

JSON nested error: Cannot read property 'length' of undefined

Having some trouble working with a nested array within a JSON in D3JS, specifically encountering a "property length undefined" error at the line: .attr("d", function(d) { return line(d.points); }). Below is the JSON data structure: [ { "aspectRatio" ...

Tips on eliminating margins from rows on smartphones using bootstrap version 4.5

In my project, I am utilizing bootstrap 4.5 and aiming to create an edge-to-edge view for mobile devices. Here is the layout I currently have: <div class="container"> <div class="row"> <div class="col-md-9> ...

State remains unchanged despite calling setState

When working with React, I encountered an issue in my function called setTitleAndBody. Even though the object result is being logged correctly and displaying the title and body information in the developer console, the setState method is not updating the ...