2

I have defined the following Help Text for a drop down list on a page in oracle APEX :

<html>
<style>
table, th, td {
  border:1px solid black;
}
</style>
<body>
<table style="width:100%">
 <tr>
    <th>Category</th>
    <th>Description</th>
  </tr>
   
   <tr>
    <td>Category1</td>
    <td>Description1</td>
    
  </tr>
  
   <tr>
    <td>Category2</td>
    <td>Description2</td>
    
  </tr>
  
   <tr>
    <td>Category3</td>
    <td>Description3</td>
    
  </tr>
    
</table>
</body>
</html>

When I click the question mark to see the help text, the style gets applied to other page items on the page, and I have to refresh the page to reset the style. How can I fix this problem?

New contributor
user31903851 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • 1
    Well table, th, td applies the style to all elements of those types, so what else did you expect, and why? If you want a style to apply to a specific element or elements, then give them a class and make the style apply only to that class Commented 2 days ago
  • P.S. If this is HTML that's designed to be included into another page as an extra item, why did you wrap it in <html> and <body> tags? This makes no sense. You cannot have more than one set of such tags in a single HTML document. The browser may have been forgiving and ignored this mistake but technically it's completely invalid. Commented 2 days ago

1 Answer 1

2

Give the element an id and only apply the styles to that id:

<style>
table#your_id_value,
table#your_id_value th,
table#your_id_value td
{
  border:1px solid black;
}
</style>
<table style="width:100%" id="your_id_value">
 <tr><th>Category</th><th>Description</th></tr>
 <tr><td>Category1</td><td>Description1</td></tr>
 <tr><td>Category2</td><td>Description2</td></tr>
 <tr><td>Category3</td><td>Description3</td></tr>
</table>

Or give the element a class:

<style>
table.black-border,
table.black-border th,
table.black-border td
{
  border:1px solid black;
}
</style>
<table style="width:100%" class="black-border">
 <tr><th>Category</th><th>Description</th></tr>
 <tr><td>Category1</td><td>Description1</td></tr>
 <tr><td>Category2</td><td>Description2</td></tr>
 <tr><td>Category3</td><td>Description3</td></tr>
</table>

Then elements without that id or class will not have the style applied to them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.