Changing text colour with Bootstrap is possible by using the CSS `

Here is the code I'm working with in my HTML file. I am trying to change the font color:

index.html

 <html>
 <head>
 ----
 ----
 <body>
 <b>Student Info</b>
 {
 "data": {
 "attributes": {
 "firstName": "xxx",  //view as json data
 "lastName": "yyy"
  ---
  ---
  }}}
   </body></head></html>

The current output is: { "data":{ "attributes":{ "firstname":"xxx" "lastname":"yyy" } } } this is how my JSON block displays, but I need help changing the font color.

Answer №1

If you're in search of syntax highlighting, I can guide you on the concept behind it instead of providing a script that automatically identifies keys and values.

.value {
  color: red;
}

.key {
  color: green;
}
<b>Student Info</b>
{<br />
    <span class="key">"data"</span>: {<br />
        <span class="key">"attributes"</span>: {<br />
            <span class="key">"firstName"</span>: <span class="value">"xxx"</span>,<br />
            <span class="key">"lastName"</span>: <span class="value">"yyy"</span><br />
     }<br />
 }

To achieve syntax highlighting, simply insert span elements into your code and enclose the keys and values within them. Apply CSS classes to these spans to alter their font colors. The rest involves formatting with correct indents and newlines.

Answer №2

experiment

<span style="color:#00ff00"> {
     "data": {
     "attributes": {
     "firstName": "John", //displayed in json format
     "lastName": "Doe"
      ---
      ---
      }}}
    </span>

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

The dropdown on my website is malfunctioning

There seems to be an issue with my dropdown button. Previously, it only appeared when clicking on a specific part of the button. I attempted to resolve this problem but unfortunately, the dropdown no longer works at all and I am unable to revert my changes ...

Using Javascript to display a Div element for a short period of time when the mouse is clicked

Having some trouble creating a hidden colored block that appears after a mouse press anywhere on the page, stays visible for 2 seconds, and then disappears until another mouse press triggers it again. I've tried using '.click(function' and o ...

Is it acceptable to employ numerous classes simultaneously?

Instead of applying individual styling attributes like background-color and border to each element, I chose to create a set of classes such as red-background, blue-text, and border-1px... Do you think this approach is acceptable or should I try something d ...

What is the best way to create five equal columns using bootstrap vue?

I found the reference here: My goal is to create 5 columns in 1 row This is my current script: <template> ... <b-row> <b-col cols v-for="club in clubs"> {{club.name}} </b-col> ...

Grouping and retrieving values from an array of JavaScript objects

I am looking to implement a groupBy function on the object array below based on the deptId. I want to then render this data on a web page using AngularJS as shown: Sample Object Array: var arr = [ {deptId: '12345', deptName: 'Marketin ...

Incorporating hyperlinks within the navigation buttons

I'm working on a design where I have six buttons that need to be displayed on top of a background image. How can I ensure that the text inside the buttons stays contained within them? Here is the current code structure I am using, which involves utili ...

Modifying the dimensions of a text input box within an HTML string using React

I'm currently utilizing a popup library called sweetalert2-react-content to generate a popup box with a textbox and a text area. Even though the elements are being created successfully, I am struggling to adjust the size of the text area in the popupb ...

none of the statements within the JavaScript function are being executed

Here is the code for a function called EVOLVE1: function EVOLVE1() { if(ATP >= evolveCost) { display('Your cell now has the ability to divide.'); display('Each new cell provides more ATP per respiration.'); ATP = ATP ...

What is the best way to transfer a data string from my HTML document to my server (using either Node or Express) and trigger a specific function with that data?

Currently, my node.js server is operational and successfully creating an excel document by fetching data from an API using Axios. Now, I am looking to implement a feature where users can input a string on my HTML page, which will then be sent to the web se ...

The left and right arrows maintain their visibility even when they are outside of the image

I am a beginner in the world of web development and I am trying to implement left and right navigation for images using arrows. My goal is to have the arrows fade in when the mouse hovers over the image and fade out when it's moved away. However, I am ...

Is it possible to convert a list-group into a dropdown menu using Bootstrap 4?

I'm currently using the latest version of Bootstrap 4 and facing a challenge with making my 'list-group' responsive. Despite searching for solutions, I have yet to find one that fits my specific needs. The 'list-group' is intended ...

Inspecting the options within a dropdown menu to adjust a styling attribute

I am in the process of developing a website that features multiple select options for creating sentences. My goal is to detect when users are changing these options to form specific sentences, such as changing "I", "Am", "Blue" to reflect the color blue. T ...

In Firefox, the focus outline is not shown on a div that has a mask-image CSS rule applied to

In my code, I have multiple div elements that have the mask-image and -webkit-mask-image CSS rules applied to them. These divs are being used as UI slider components, so I want keyboard users to be able to tab between them and use the arrow keys to adjust ...

What could be the reason for this CSS selector not functioning as anticipated?

What is the reason that the text "Won" is not turning red in the code snippet below? The CSS selector #sisters>*~#too should target all elements that come before the element with ID #too, including the element with ID #won. However, only the element wit ...

Arrange two images next to each other using Bootstrap grid system

Struggling to replicate the design of this website: Fister. But unfortunately, my images are not aligning properly. <html> <head> <meta charset="utf-8"> <!-- CSS only --> <link href="https://cdn.jsdeli ...

stacking order of floated and positioned elements

After researching on MDN and reading through this insightful blog post, it is suggested that in the absence of a z-index, positioned elements are supposed to stack above float elements when they overlap. However, upon closer examination, the example prov ...

Using PHP to generate an HTML table with clickable links that retrieve database elements to populate a subsequent page

Currently, my website allows users to select a serial number from a dropdown and submit it, which then populates multiple HTML tables on the display.php page with corresponding database elements. Now, I am looking to achieve the same result using a differe ...

Following a successful ajax response, the functionality of the JavaScript ceases to operate

Once an Ajax request is successfully sent, the jquery.hover() function no longer works with the new content on the page. Is there a method to refresh the script without reloading the entire div through another ajax request, in order to make it functional ...

Issue with compiling Tailwindcss in nextjs JIT mode

Our current project involves using tailwindcss and things were going smoothly until the clients requested a "pixel perfect" design. This meant that every element needed to be set in pixels instead of rem units. Instead of adding countless classes like h-1p ...

Tips for Making a Div 100% Width While Hiding Another Div Using jQuery

I am looking for a solution to adjust the width of the blue div to 100% when hiding the red div. Can anyone help with this? Here is my JavaScript code <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script> ...