Apply CSS to give each line of text a box shadow effect

My CSS notebook creation featuring box-shadow and margin can be viewed here: JSFiddle

The issue I'm facing is that when a line break occurs, the notebook row expands, causing it to lose its notebook-like appearance. Is there a way to ensure each line appears below every row of text?

Daniel

HTML

<div id="receitas">
  <br />
  <div class="ingredientes">
    <div class="titulo">
      <p>Ingredientes</p>
    </div>
    <ul>
      <li>&nbsp;</li>
      <li><p class="subtitulo">Massa: </p></li>
      <li><p>2 colheres de (chá) de bicarbonato</p></li>
      <li><p>1 e ½ xícaras de (chá) de Leite Porto Real Tipo A, não pode ser desnatado</p></li>
      <li><p>1 xícara de (chá) de chocolate em pó</p></li>
    </ul>
  </div>

CSS

#receitas {
  position: relative;
  width: 100%;
  font-family: 'Crafty Girls', cursive;
  font-size: 15px;
  margin-top: 30px;
  width: 410px;
}

#receitas .ingredientes {
  width: 100%;
  max-width: 600px;
  padding: 2px 2px 0 0px;
  margin: 0 auto;
}

#receitas .ingredientes p {
    margin: 0 0px;
    line-height: 25px;
    margin-left: 30px;
    color: rgb(128, 128, 128);
}

#receitas .ingredientes .titulo {
    font-weight: bold;
    position: relative;
    margin: -13px 10px;
}

#receitas .ingredientes .subtitulo {
    font-weight: bold;
}

#receitas .ingredientes .titulo p {
    -webkit-transform: rotate(-4deg);
    -moz-transform: rotate(-4deg);
    -ms-transform: rotate(-4deg);
    -o-transform: rotate(-4deg);
    transform: rotate(-4deg);
    background: url(/images/agronelli/alimentos/receitas/fundotitulo.png) no-repeat top left;
    margin: 0 auto;
    width: 150px;
}

#receitas .ingredientes ul {
    margin-bottom: 0px;
    padding-right: 5%;

}

#recei...

Answer №1

Consider using a repeating background image in place of box-shadow. Check out this fiddle to see an example: http://jsfiddle.net/9u7gc1wp/

In the code snippet below, we've added a gradient background that transitions from blue to transparent and then repeats accordingly.

#receitas .ingredientes ul {
    margin-bottom: 0px;
    padding-right: 5%;
    background: linear-gradient(to bottom, rgba(161,215,243,1) 8%,rgba(255,255,255,0) 9%,rgba(255,255,255,0) 95%,rgba(161,215,243,1) 100%);
    background-size: auto 27px; 
}

We made some adjustments to your CSS code, including removing instances of box-shadow, as well as adjusting padding and margins. Refer back to the fiddle for a comprehensive view of all modifications. You may need to customize the background height and line-height to better suit your actual content.

This is how the result appears:

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 is the process for altering the background color in this html5up template?

I am struggling to change the brown background color on my website. Despite updating various color values in the CSS file such as'backgroundcolor', I seem unable to make any changes. I have tried altering multiple color entries, but nothing seems ...

When scrolling, the menu is being overlapped by the Carousel in HTML5, CSS3, and

I am currently working on a One Page HTML webpage that needs to be responsive, and the requirement is to use Bootstrap. I have gone through all the tags but can't seem to identify the issue. One problem I encountered is that when I scroll down the pa ...

Create an HTML document with a text element that has a bottom

I need to emphasize specific text that requires underlining. <div><span class="text">Underlined</span><br>blah blah</div> As a result, the content should be displayed as follows: Underlined --- blah blah In my SASS/SCS ...

Discover the row and column of a selected table cell using vanilla JavaScript, no need for jQuery

In my JavaScript code, I am currently working on creating an onclick function that will display the row and column of a specifically clicked cell in a table. I have successfully implemented functionality to return the column number when the cell is click ...

How can you prevent a draggable element from surpassing the bottom of the screen?

I'm dealing with an element that I want to make draggable only along the Y-axis. It needs to be able to go past the top of the screen, but I need to restrict it from going past the bottom of the screen. I recently came across the containment feature i ...

"Troubleshooting the Touch Functionality on Bootstrap Carousel for Mobile

Sections of my responsive website utilize a bootstrap carousel to cycle through text and images. However, during testing, it was discovered that users on iPads were unable to swipe up and down to view more content on the site. It seems that swipe compatibi ...

Problem with CSS layout on Internet Explorer 9

I've encountered some layout difficulties in IE9 and I'm struggling to identify the root of the problem. Even though I'm using Foundation 5, I don't believe that's the issue. The content is within a Foundation grid set at large-12 ...

Is there a way to restore a minimized min.css file?

Recently, I attempted to utilize an online tool for unminifying my CSS code. However, when I replaced the minified code with the unminified version and accessed the URL, I discovered that the entire website had lost its layout. Unfortunately, relying sole ...

What is the best way to enhance the appearance of a list item that includes a visited hyperlink?

Currently, I am utilizing Stylebot in Chrome to modify certain styles on a webpage that I frequently browse. My goal is to conceal elements in a list that have links I have already visited. For instance, there is a <tr> with the class table-row, and ...

Display the entire HTML webpage along with the embedded PDF file within an iframe

I have been tasked with embedding a relatively small PDF file within an HTML page and printing the entire page, including the PDF file inside an iframe. Below is the structure of my HTML page: https://i.stack.imgur.com/1kJZn.png Here is the code I am usin ...

Struggling to perfect your CSS menu design?

For some time now, I have been experimenting with CSS menus that have three levels, but unfortunately, I am struggling to get the layout exactly how I want it. The menu structure itself is simply a series of nested unordered lists within the HTML: <ul ...

What is the reason for the presence of additional space below when using x-overflow:hidden?

When I place two spans inside each other and use overflow-x:hidden on the inner span, it results in extra space below the inner span. Why does this happen? <span style="" class="yavbc-color-tip"><span style="">Some text</span></span&g ...

Guide on how to prevent Paste (Ctrl+V) and Copy (Ctrl+C) functionalities in a TextField within MaterialUI

Is there a way to restrict the Paste (Ctrl+V) and Copy (Ctrl+C) functions in a specific TextField within MaterialUI? I am currently working with ReactJs ...

Is Flex still wrapping elements even when set to nowrap?

My goal is to create a layout with 4 blocks, where the first section contains 2 blocks each occupying 50% of the width, followed by 2 other blocks in the next section. I am utilizing the flex property for this layout. I want the flex-container to take up ...

Animating rows in the grid auto property

I am working with a basic css grid that contains X number of grid items. These grid items can vary in size and I need to implement an expander feature. The goal is to initially display only a certain number of rows, but upon clicking a button, the grid wil ...

Fade out and slide close a div using jQuery

I am creating a new website and incorporating jQuery for animation and simplified JavaScript implementation. My goal is to have a button that, when clicked, will close a div with a fading out and slide up effect. Can this be achieved? Thank you. ...

CSS - Adding a Distinctive "Line" to a Navigation Bar

I am attempting to design a unique navbar layout with two "lines". The first line should consist of several links, while the second line would include an HTML select field with a submit button. The following code will generate the desired navbar visual ou ...

What could be causing the extra space around my body on mobile devices?

I am currently delving into the world of responsive design, starting from square one. My aim is to create a minimalist webpage with no side margins. However, when viewing it on an iPhone, there still seems to be a significant white margin on either side. T ...

Adjust the dimensions of a nested element within a container that has padding applied

After browsing through numerous similar questions regarding this issue, I have not been able to find a solution that works for my specific case. The HTML code in question is as follows: a{ display: block; padding: 3px 20px; clear: both; font-weight: ...

JavaScript Age confirmation Overlay

I designed an age verification popup with the help of some online tutorials and a friend due to my limited knowledge of JavaScript. Check it out live here- My issue is that I want this popup to load/appear after the page content loads, but I'm not s ...