imported body with html in it color attributes not showing in ckeditor

49 Views Asked by At

I upload an html coded file into ckeditor and everything displays fine ( Tables ,text boxs etc,) but none of the color attributes work for fonts or back grounds. Not sure what's up.

        var HTMLBody = "Hello  " + @Model.firmname + " ,";
    
    HTMLBody += "<br><br> Here is a work order for items listed<br><br>";
    HTMLBody += "<style> table, th, td {border: 1px solid black;} </style><table width=600> ";
    HTMLBody += "<TR bgcolor=#22B14C><TD  colspan='2'><center>Work order form</td></TR>";
    HTMLBody += "<TR><TD style='width: 80px'>Hello: </td><TD><font color=black> " + @Model.firmname + "</font></td></TR>";
    HTMLBody += "</table>";
    
    
    HTMLBody += "<style> table, th, td {border: 1px solid black;} </style><table width=600> ";
    HTMLBody += "<TR bgcolor=#EEEEFF><TD  style='width:80px'>Network :<font color=black> </td><TD bgcolor=#FFFFFF> " + @Model.network + "</font></td></TR>";
    HTMLBody += "<TR bgcolor=#EEEEFF><TD  style='width:80px'>Address  :<font color=black> </td><TD bgcolor=#FFFFFF>" + @Model.address + "</font></td></TR>";
    HTMLBody += "<TR bgcolor=#EEEEFF><TD style='width:80px'> Type of Project : <font color=black></td><TD bgcolor=#FFFFFF>" + @Model.typeprojet + "</font></td></TR>";
    HTMLBody += "<TR bgcolor=#22B14C><TD  colspan='2'><center>Work Description</td></TR>";
    
    HTMLBody += "</table>" + "<BR><BR>";

<tr>
            <td colspan="8">
                @Html.LabelFor(model => model.Body)
                
              
                @Html.TextArea("editor", HTMLBody, new { @class = "ckeditor", @id = "Body" })
            </td>
        </tr>

Everything displays fine except for the fact there is no color.

1

There are 1 best solutions below

1
On

You need to add color within the style attribute:

<td style="width: 80px; color: black; background-color: #fff">Network</td>