5 replies [Last post]
JackP
JackP's picture
Offline
newbie
Last seen: 3 years 32 weeks ago
Timezone: GMT-5
Joined: 2016-04-27
Posts: 3
Points: 4

Is it possible (I know it may not be great form) to reference ID and class in the div tag of the HTML document?

eg:

#state {
    border-left: 1px solid #B9C0C6;
    padding-left: 1px;
}
.Title {
    background-color: pink;
    border-left: 1px solid red;
}

to something like:

<div style="what do I put here to reference #state and .title /div>

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 5 days 6 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Hi Jack, It's possible I

Hi Jack,
It's possible I don't understand the question.
Do you mean:

<div id="state" class="title">

JackP
JackP's picture
Offline
newbie
Last seen: 3 years 32 weeks ago
Timezone: GMT-5
Joined: 2016-04-27
Posts: 3
Points: 4

Thanks for your reply. I am

Thanks for your reply.

I am trying to set a style for a specific items in my HTML WITHOUT using a style sheet.

Lest say these are the ID and class items that would go into a style sheet:

#state {
    border-left: 1px solid #B9C0C6;
    padding-left: 1px;
}
.Title {
    background-color: pink;
    border-left: 1px solid red;
}

I dont want to use the style sheet, but want to format their style in the DIV tag.
so if I had<div style="background-color: pink;">
everything in that div would have a pink background. I just want ID "Title" to have a pink background

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 9 hours 42 min ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9745
Points: 3824

Is this for html email? I

Is this for html email? I can't think of another legitimate reason to inline style declarations, and that assumes that email should ever be html rather than plain text. If that is the case, your email client/composer should handle that for you.

Try this:

<p>What do I put here to reference <span style="border-left: 1px solid #B9C0C6; padding-left: 1px;">#state</span> and <span style="background-color: pink;   border-left: 1px solid red;>.title</span></p>

The span element is used to segregate inline content for special handling.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

JackP
JackP's picture
Offline
newbie
Last seen: 3 years 32 weeks ago
Timezone: GMT-5
Joined: 2016-04-27
Posts: 3
Points: 4

I cant use span. Im trying to

I cant use span. Im trying to change some of the formatting on a company intranet site and the entire chunk is in an iframe. the iframe refers to a css sheet and I really didnt want to recreate the style sheet and have to post it elsewhere. I just wanted to make some of the id elements bigger, bolder or more contrasty without changing the entire iframe

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 9 hours 42 min ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9745
Points: 3824

???

An iframe imports a file to be displayed in the current document. You need to edit the imported file.

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.