What is the best way to incorporate a style attribute into my EJS page content?

Having trouble with adding custom style. It seems to work, but there's an error displayed. Apologies for my poor english :(

<div class="card card_applicant">
                <div class="card_title" style="background-color: <%= aday.Renk %>;" >
                    <h3 class="card-title"><%=(aday.Soyadi).toUpperCase() %></h3>
                </div>

It's functioning, however :

https://i.stack.imgur.com/Mw9da.png

https://i.stack.imgur.com/87l94.png

Answer №1

Do the elements vanish when utilizing template literals instead like this:

<div class="title_card" style="<%= `background-color: ${day.Renk}` %>" >
   <h2 class="card_title"><%=(day.LastName).toUpperCase() %></h2>
</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

Unable to alter the css of a jQuery object

I have been attempting to modify the CSS of two child elements of a specific element using Backbone and jQuery. However, my code does not seem to be working as expected. I suspect that the issue lies in distinguishing between a DOM element and a jQuery obj ...

What is the best way to smoothly reveal images one by one?

My goal is to smoothly slide three images inside a div, one by one. However, I'm facing an issue where the images stack on top of each other and end up stuck in their original positions. Here is the code snippet I've been working with: <div ...

JavaScript and jQuery experiencing difficulty rendering proper style and image in output display

I am currently working on code that extracts information from a JSON variable and displays it on a map. The code looks like this: marker.info_window_content = place.image + '<br/>' +"<h4>" + place.name + "</h4> ...

The Table and Div elements do not have identical widths when set to 100%

I am facing an issue with a Div and Table placed inside a container. Although they are meant to completely fill the container, occasionally there is a one pixel difference which can be quite annoying. I have prepared a test case and attached a screenshot h ...

Achieving perfect alignment of two elements using flexbox: centering one and aligning the other to the right

Can you help me with aligning two elements to the center and right edge using flex? I am trying to achieve a layout similar to the image. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX CSS Styles .flex{ display: flex; justify-content: space-between; align-i ...

What are the best ways to enhance performance when making multiple require() calls?

I am in the process of developing a bot for my company's Mattermost server (similar to a Discord bot). Each command for the bot is housed in its own file, making it easier to manage and maintain. When a user wants to execute a command, they must send ...

What is the process for publishing to a nested field within a detailed mongoDb structure?

I am facing some difficulties with making a post request to my mongoDb schema. The schema is located in the model folder at the root directory of my app. const mongoose = require('mongoose'); let Schema = mongoose.Schema; const userSchema = new ...

Installation of the Create React Native app was unsuccessful

After hearing about Create React Native App being the simplest way to start a new React Native application, I decided to install it. However, my attempt was unsuccessful. My Node version is v8.10.0 and npm version is v4.2.0. I encountered an error which h ...

Identifying Provider Logouts in Node.js Using OpenID

I am currently in the process of integrating OpenID with a Node.js server by utilizing this specific library. While logging in is relatively simple, I am facing challenges when it comes to detecting when a user logs out from their OpenID provider. For ins ...

Eliminate the approximately 20 pixel space on the right side of the HTML email when viewed on iOS

Recently, I've been focused on developing a contact form for my portfolio website. Successfully sending HTML emails from the server to my email address has been a highlight. Since I mainly access my emails on my iPod Touch, I tailored the mail templat ...

Place objects at the bottom of the container

Is there a way to align each "Read more" button at the bottom of its respective div without setting a specific height for the divs or changing any markup or style elements? While pseudo class selectors could be used, is there a simpler approach that would ...

The versions displayed by `node -v` and `nodejs -v` are not

Why are the versions of node -v and nodejs -v different? My current version for node -v is 4.2, while nodejs -v displays 6.10.3. What could be causing this discrepancy? I would like node -v to display 6.10.3 instead. ...

element obscured by overlapping elements

I'm unsure why this issue is occurring; it seems to be a CSS error, but I can't pinpoint the exact location. Working on this in Rails, so I'm relatively new to it, but it should follow standard CSS practices! The "ticket" element appears t ...

Setting up a Docker configuration for an Angular project

Apologies for my imperfect English. I am new to Docker and finding it challenging. Currently, I am trying to configure this project: After adding two files This is my docker-compose file web: build: . ports: - '49153:49153' ...

Send information from Node.js to the webpage and populate designated elements (search by either ID or class) on the webpage

After successfully retrieving data from the mongo database using nodejs, my goal is to display this data on a webpage. function requireUser(req, res, next){ //console.log(req.session.username); if (!req.session.username) { res.redirect('/user_un ...

Format the image to fit within a div container

I'm currently utilizing Bootstrap and am looking to insert some images into my div while ensuring they are all the same size (standardized). If the images are too large (as they typically are), I want to resize them to fit within my div and crop them ...

The images have been successfully uploaded, but they are not displaying in the user interface of Sails JS

I am experiencing an issue where images uploaded to the assets folder are not immediately visible in the UI. It is only after restarting the server that the images become visible. Problem: The images are being stored in the assets directory, but they are ...

Creating a new vertex in AWS Neptune database using JavaScript and Gremlin query language while optionally adding an edge

At times, it may be necessary to create a Vertex with an optional Edge. g.addV('label') .property(id, 'uniq_id_2').as('u') .property('edge_is_needed', edgeIsNeeded) .constant(edgeIsNeeded) .choose(eq(true), addE( ...

Encountering a fatal error: unable to spawn process due to ENO

I've been struggling with creating a window installer for the past four days, and encountering an error when trying to execute `common.js`. Upon analysis, I found: child = child_process.spawn(cmd, args, opts); children.push(child); The code abo ...

When using vue-resource for an http request, the error message "_.isArray is not a function" may be

Attempting to retrieve an object from a server located at localhost:3000. The object is visible when accessing the address via a web browser. In my Vue instance's methods property, I have a function that is executed on the front end: goToTutors: fun ...