I am interested in utilizing CSS and R markdown for constructing css boxes while keeping the overall template unchanged. How can I achieve this?

Perhaps this is a simple question, but I am struggling to find a solution. I have created an "R markdown" document for teaching statistics, and I'm using a CSS file to customize the appearance of my questions. The CSS file I've included from here allows me to create question boxes like this one:

https://i.sstatic.net/ZQc7F.png

However, whenever I type "1. " or "2. " in my R Markdown file, it automatically gets transformed into a question box. How can I adjust the CSS to prevent this from happening to all my lists?

Thank you.

Please see the CSS file below:

 // CSS code goes here... 

Answer №1

If a similar issue arises, this serves as the resolution.

To format CSS commands in the file, initiate with a specific string (provided below) and then utilize the div notation in Markdown. For instance:

<div class="question">
1. First inquiry
1. Second inquiry
</div>

  /* -----------Inquiry counter ---------*/

  body {
    counter-reset: li;
  }
 h1 {
    font-family:Arial, Helvetica, sans-serif;
    font-weight:bold;
 }

 h2 {
    font-family:Arial, Helvetica, sans-serif;
    font-weight:bold;
    margin-top: 24px;
 }
  .question ol {
    margin-left:0; /* Eliminate default left margin */
    padding-left:0; /* Erase default left padding */
  }

  .question ol>li {
    position:relative; /* Establish a positioning context */
    margin:0 0 10px 2em; /* Assign a left margin to each list item for numbering */
    padding:10px 80px; /* Introduce spacing around content */
    list-style:none; /* Disable usual item numbering */
    border-top:2px solid #317EAC;
    background:rgba(49, 126, 172, 0.1);
  }

  .question ol>li:before,
  .question ol>p>li:before {
    content:"Inquiry " counter(li); /* Employ the counter as content */
    counter-increment:li; /* Increase the counter by 1 */
    /* Position and style the number */
    position:absolute;
    top:-2px;
    left:-2em;
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box;
    width:7em;
    /* Provide space between number and content in browsers supporting generated content but not positioning (e.g. Camino 2) */
    margin-right:8px;
    padding:4px;
    border-top:2px solid #317EAC;
    color:#fff;
    background:#317EAC;
    font-weight:bold;
    font-family:"Helvetica Neue", Arial, sans-serif;
    text-align:center;
  }

  .question ol ol {
    counter-reset: subitem;
  }

  .question li ol,
  .question li ul {margin-top:6px;}
  .question ol ol li:last-child {margin-bottom:0;}

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

Error: The Vue bind object property cannot be read because it is undefined in the class binding

I'm attempting to associate a class with an object property, but I encounter an issue when trying to trigger the @click event on the list object - the console states that it cannot read the isSelected property of the object. My goal is to activate a c ...

Unused sizing attributes in IMG tags

I can't seem to figure out what's going wrong here... I want the image tag to initially display the 250px wide "small" image, and then allow the browser to select the most suitable image using the srcset and sizes attributes - essentially, the " ...

Whenever I attempt to style a html/jsx tag in css, I receive an error message stating that 'h1 "selector" is not pure'

Issue: The CSS selector "h1" is not considered pure (pure selectors must include at least one local class or id) 5 | } 6 | > 7 | h1 { | ^ 8 | font-size: 48px; 9 | text-align: center Encountered this error while attempting ...

Tips for effectively closing div elements

How can I modify this accordion to close when a user clicks on another link, and also change the image of the open "p" tag? Currently, clicking on a link toggles the content and changes the image. However, what I am struggling with is closing the previousl ...

Using Javascript to extract information from the div element

Within my HTML code, I have a total of 4 <div> tags and a corresponding <a> tag for each of these <div> tags. Inside each div tag, there are 2 span tags and an additional a tag. Upon clicking the a tag, I aim to extract the product name ...

What is the best way to share an HTML element across multiple pages in Next.js?

I am in the process of developing a website that features a table of contents with links on the left side, content sections in the middle, and an overview on the right. For a visual representation of the general concept, please visit: https://i.sstatic.net ...

Is it possible to install a Chrome extension specifically for YouTube on Google Chrome?

Hey, I'm trying to eliminate thumbnail images from YouTube. The code I am currently using is: while (true) { $("ytd-thumbnail").remove() } As of now, when I input this code in the console, it successfully removes all thumbnail images. However, I ...

What is the best way to incorporate CSS into this HTML document?

Content has been omitted. It is crucial to review documentation in advance in order to reduce repetitive inquiries. Check out the Webpack v2 documentation. ...

choose exclusively the text within the elementor navigation menu

I've been tinkering with this issue for a few hours now. I have a vertical Elementor navigation menu and I'd like to add a hover effect to it. So far, I can only select the entire column and apply the effect to that, not just the length of the t ...

Concealing inactive select choices on Internet Explorer versions greater than 11 with the help of AngularJS

I am having trouble hiding the disabled options in AngularJS specifically for IE. Check out this fiddle for a better idea: https://jsfiddle.net/s723gqo1/1/ While I have CSS code that works for hiding disabled options in Chrome/Firefox, it doesn't see ...

parallax scrolling can be a bit bumpy

While working on a website, I've incorporated a slight parallax effect that is functioning almost perfectly. However, I've noticed that the foreground divs tend to jump a little when scrolling down the page. At the top of the page, there is a di ...

Shifting and implementing various styles across numerous elements at the same time

There is an anchor tag containing two spans... <a class="banner-logo" href="/search"><span id="banner-logo-hello">Hello</span><span id="banner-logo-world">World</span></a> When hovering over the anchor tag, I want to c ...

How can triple nested quotes be utilized within Django templates?

Currently, I am attempting to utilize inline CSS and load an image as a background in a Django template. My goal is to include three quotes, however, I am unsure of the correct way to achieve this. Can anyone provide guidance on how to properly modify the ...

Having trouble deleting files in PHP?

I am presenting an HTML form below: <form action='delete.php' method='POST'> <table> <div class = '.table'> <?php $dir = '../uploads/store/'; $new ...

Display a single image on the tablet and a distinct image on the computer

Currently, I am encountering an issue with my webpage located at . The problem lies in the right upper corner where a ribbon is located. However, when viewing the page on a tablet, the ribbon overlaps with my menu. To resolve this, I thought about displa ...

javascript execute while load

I'm having trouble initializing inputs with maps api autocomplete based on the number of inputs retrieved from the database. I'm trying to run a simple JavaScript function within a while loop, but it's not working as expected. Although the ...

Is it possible to dynamically alter a CSS property using styled components when an onClick event occurs?

Hey there, I'm pretty new to React and currently exploring styled components for the CSS styling of my components. One of the components I've created is a button called SummonButton: const SummonButton = styled.button` height: 50px; borde ...

Update the year variable in the dataframe based on the current season

I'm working with a dataframe structured like this: set.seed(50) df <- data.frame(Month=c(sort(sample(1:12, 10)), sort(sample(1:12, 10)), sort(sample(1:12, 10))), Year=c(rep(2007, 1 ...

Strip inline styles from HTML content in django-tinymce

I am experiencing an issue with django-tinymce where it automatically adds inline styles when I save content. I would prefer to remove this behavior and only save the content in plain HTML. Can someone assist me with resolving this problem? ...

Is it possible to change the background color of a Bootstrap button using CSS overrides?

Desired Outcome https://i.sstatic.net/EjEXG.gif Actual Result https://i.sstatic.net/BmXYG.gif The goal is to toggle the red-background class, so that when hovering over the button-bullet, its background-color changes to #FCC1C5. Avoiding the use of .b ...