Can HTML blocks be coded to have a triangular shape and content inside?

An old colleague who used to work with me recently sent over a website design concept.

Here's a section of the page showcasing a list of posts -

Upon closer inspection, I noticed that most of the pink polygons are just background elements while some triangles and rhombuses can contain short text (which I masked with a gray brush), titles, and occasional icons.

I'm curious if there is a way to achieve this effect using html/css/js without relying on flash?

Answer №1

If you're looking to enhance your website with interactive elements, consider using dynamicHtml in combination with JavaScript. For inspiration, check out this example site:

Experiment with some high-quality JavaScript libraries like the one available at:

Another option is utilizing HTML5 Canvas. Visit this example site to see what can be achieved:

A creative approach could be creating a large texture.png file in the shape of a diamond and positioning it to the left or right side of your page (a personal favorite).

Remember that when adding visual elements, it's important to consider the layout and how they impact the overall look and feel of your design.

Answer №2

To achieve this goal in a way that is compatible with older browsers, you can utilize a somewhat cumbersome CSS blocking technique...

http://jsfiddle.net/AuZ5H/2

.wrapper {
    background-color: #eee;
    width: 250px;
    height: 225px;
    font-size: 8px;
    overflow: hidden;
}
.block {
    float: right;
    clear: right;
    background-color: #ddd;
    height: 25px;
}
.block1 {
    width: 200px;
}
.block2 {
    width: 150px;
}
.block3 {
    width: 100px;
}
.block4 {
    width: 50px;
}
.block5 {
    width: 1px;
}

<div class="wrapper">
    <div class="block block1"></div>
    <div class="block block2"></div>
    <div class="block block3"></div>
    <div class="block block4"></div>
    <div class="block block5"></div>
    <div class="block block4"></div>
    <div class="block block3"></div>
    <div class="block block2"></div>
    <div class="block block1"></div>
    Content here.
</div>

Increasing the number of blocks used, each with smaller heights, will result in a more detailed layout. For rhombuses, you would need to duplicate and reverse the blocks accordingly.

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 avoiding a large <ul> element from spilling over the body in a flexbox design

I struggled to articulate the problem I am facing, and I apologize if it's still unclear So, in my app, I have 3 cards, and the 2 side ones contain lists (<ul>) that can become quite lengthy. I want the scrollbar to appear on the <ul> its ...

What steps should be followed to display an HTML page within an HTML div?

The question I have is a bit misleading, as I'm not looking for guidance on how to open an HTML document in a div. Rather, I am currently facing an issue where I am unable to replace the HTML file that I have already placed in a div. Initially, I pla ...

I must update the color of the Div Element to match the text content

Is there a way to dynamically change the text color of a span element based on its content without using nth-child or inline classes? Unfortunately, due to CMS restrictions, those options are not available. If this can be achieved solely with CSS, that wou ...

Position the navbar toggle button on the right side

I am currently experimenting with Bootstrap 4, particularly the navbar menu feature. Is it possible to align the small navbar toggle button to the right of the page instead of having it float to the left next to the logo? https://i.sstatic.net/UfKl2.png ...

Centered Fixed Upward Scrolling Div

Currently facing a challenge with my project involving a chat interface created in Angular. I am struggling with the CSS styling as the chat starts at the top and scrolls downward off-screen as the conversation progresses. Although I can scroll along with ...

Tips for designing a navbar specific to a profile section

I am currently working on an angular application with a navigation bar composed of anchor tags. When the user logs in, I have an ngIf directive to display my profile icon with dropdown options. However, I am facing challenges in styling it correctly. I aim ...

Explore the differences between the "date" type in HTML and the Date object in Typescript

Here is some code in HTML: <div class="form-group row"> <label class="col-sm-2 col-form-label">Due date: </label> <div class="col-sm-10"> <input type="date" class="form-control" #due_date> ...

Use jQuery to dynamically assign a unique div id to a specific class element

<div class="leaflet-marker-icon"></div> <div class="leaflet-marker-icon"></div> <div class="leaflet-marker-icon"></div> <div class="leaflet-marker-icon"></div> The map generates these divs, all with the s ...

two occurrences of the identical controller in AngularJS

Encountering a dilemma (admittedly, not the best approach). There is a single view featuring a split screen; an input field occupies the left side while its corresponding value appears on the right. Both sides are managed by the same controller, using the ...

I'm having trouble retrieving and rendering data in HTML using AngularJS and Spring

After fetching the data, I am unable to see it in the HTML code. The web browser console displays the JSON data but it is not visible in the HTML code. Here is my AngularJS code: $scope.refresh = function(){ fetchData(); }; $scope.fetchData = functio ...

The battle between "this" in HTML and AngularJS ng-model

We have been working on updating an old ColdFusion application that utilized "this" with a formatting function: <td>$<input type="text" name="txtTaxProration" id="txtTaxProration" value="0.00" alt="Tax Proration" onblur="dollarBlur(this);">< ...

What might be causing my image element in JavaScript to be unable to load a path (src) from an array?

I'm trying to create a slideshow, but I'm having trouble getting the image element to pick up the source from a script. When I hardcode the source in the img element, it works fine. However, when I store the path in an array and try to load it us ...

Why isn't the dropdown menu displaying beneath the background in bootstrap / HTML / CSS?

Having trouble creating a navbar with a dropdown menu on the right? I encountered an issue where the menu doesn't show up when clicked. However, after removing all CSS styles, the button starts working. .info { margin-top: 15%; display: table; ...

Having trouble with your jQuery slideDown menu?

I am facing the exact same issue I had last week. Here is an example of my HTML code: <article class="tickets"> <div class="grid_12 left"> <div class="header"> <i class="ico ...

Troubleshooting Alignment Problems in HTML5 and CSS

Check out my awesome page here: My Page To help with troubleshooting, I've assigned different background colors to the 3 sections of my page. The "Zine" should be red, the "Book Cover" green, and the "Magazine" yellow. However, I'm experiencing ...

Determine the minimum width in an HTML table's <td> tags

One issue I have encountered is with the columns in my table. I need each column to adjust its width dynamically based on the size of the browser window. However, I also want to ensure that the columns are not too small. To address this, I attempted to se ...

Disable the button until all input fields contain text in ASP

Curious if anyone knows how to disable a button until all text boxes have input in ASP.NET and C#. Here is an image showing the scenario I'm referring to - wanting to gray out the commit button. Thanks, Chris! ...

Creating custom Bootstrap Card Groups by dynamically generating the specified number of cards with Angular directives

I am currently using Angular 9.1.8 for my project. For my Angular component, I have implemented Bootstrap Card Groups and Cards to display a large result set of cards in rows with more than two cards per row. Below are four example cards: <div class=&q ...

Adding a contact form to a slider: A step-by-step guide

Currently, I am faced with the challenge of placing my form on a slider in such a way that the slider appears to be running in the background of the form. When using position absolute, I find myself having to apply excessive margins and top pixels due to t ...

Tips for updating sass import files as the body class changes

Is there a way to dynamically change the SCSS file with color variables based on the changing body class? For example, if my HTML includes: <body class="custom"> ... </body> I would like to load in style.scss: @import 'custom&a ...