2

Hello I am building a flask web application and including a web text editor called ckeditor into it. I figured out how to include custom resume templates into my application by modifying a file called default.js. I think anyone who knows a lot about javascript could help me out, without knowing about ckeditor specifics

My issue is that I want to style the html such as name in the h1 tag etc but am not sure how to do this. The default.js file uses a javascript array to render templates. How would I link a css stylesheet to the html I have in default.js and actually have it be styled. Any help would be appreciated!

Here is the script I have in that default.js, which currently renders one template

// Register a template definition set named "default".
CKEDITOR.addTemplates( 'default',
{
    // The name of the subfolder that contains the preview images of the templates.
    imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),

    // Template definitions.
    templates :
    [
        {
            title:'Resume Simple',
            image:'resume1.jpg',
            html:
            '<h1>Name</h1>' +
            '<p>[Address, City, ST Zip Code][Telephone][Email]'+
            '<h3>Education</h3>'+
            '<p>[Degree][Date Earned][School]</p>'+
            '<h3>Skills & Abilities</h3>'


        }
    ]
});

1 Answer 1

1

You can style these elements like any other HTML elements with CSS, either by directly targeting the HTML tags or by adding CSS classes to the HTML code located in the default.js file, like this (notice the class="name"):

templates :
[
    {
        title:'Resume Simple',
        image:'resume1.jpg',
        html:
        '<h1 class="name">Name</h1>' +
        '<p>[Address, City, ST Zip Code][Telephone][Email]'+
        '<h3>Education</h3>'+
        '<p>[Degree][Date Earned][School]</p>'+
        '<h3>Skills & Abilities</h3>'
    }
]

Your CSS could look like this:

/*styling the HTML element*/
h1{
    color:red;
    ...
}
/*or styling the class*/
.name{
    color:red;
}

You will either place it directly in a <style> HTML element in your page, or in a CSS file.

Here you can learn more about CSS http://www.w3schools.com/css/

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

2 Comments

thanks that worked. I included a '<head><link...></head>' to link to an external stylesheet
that's probably the best way to do :)

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.