Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8807741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:26:33+00:00 2026-06-14T02:26:33+00:00

I want to target specific iframes using a class attribute in order to set

  • 0

I want to target specific iframes using a class attribute in order to set the width with CSS.

The iframes are google maps embeds like this one:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.uk/?ie=UTF8&amp;t=m&amp;ll=52.8382,-2.327815&amp;spn=4.646012,9.338379&amp;z=6&amp;output=embed"></iframe>

They are copied and pasted into the HTML source editor of tinyMCE. I need to apply a class attribute to the iframe but it is striped out when clicking update on the source editor.

I’ve tried using valid_elements and extended_valid_elements in the config but neither work for iframe[class].

I’m running version 3.4.3. I downloaded 3.5.7 and the it seems to have the same problem. The behaviour is also exhibited on the demo on the tinyMCE website (http://www.tinymce.com/tryit/full.php) despite the docs for valid_elements stating that the class attribute is supported (http://www.tinymce.com/wiki.php/Configuration:valid_elements).

Here is the full config:

tinyMCE.init({
    // General options
    mode : "specific_textareas",
    editor_selector : "formInputWysiwyg",
    theme : "advanced",
    plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,wordcount,advlist",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,strikethrough,formatselect,styleselect,undo,redo,|,code,|,fullscreen,",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,|,search,replace,|,bullist,numlist,|,blockquote,nonbreaking,|,charmap,media,|,link,unlink,anchor,image",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    width : "500",
    height : "600",
    apply_source_formatting : true,
    remove_linebreaks: true,
    theme_advanced_blockformats : "p,blockquote,h1,h2,h3,h4,h5,h6",
    forced_root_block : false,
    plugin_preview_width : "1050",
    plugin_preview_height : "800",
    convert_urls : false,
    extended_valid_elements : "figure,figcaption",

    // Skin options
    skin : "o2k7",
    skin_variant : "silver",

    // Example content CSS (should be your site CSS)
    content_css : "/admin/includes/css/tinymce.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",

    // Style formats
    style_formats : [
        {title : 'Google Maps', selector : 'iframe', classes : 'google-maps-embed'},
        {title : 'Intro', selector : 'p', classes : 'intro'},
        {title : 'News Image', selector : 'img', classes : 'news-image'}
    ],
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:26:35+00:00Added an answer on June 14, 2026 at 2:26 am

    Have you got the ‘media’ plugin enabled? I’m seeing a similar problem, and I wonder whether the media plugin is interfering with the normal operation of the editor on HTML elements. I tried creating a style_formats option to manipulate the iframe, but without any luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to target a specific location on the image to be cropped using css
So sometimes (oftentimes!) you want to target a specific .NET version (say 3.0), but
i want to target closest div from my anchor tag. so in order do
I want to target an HTML element when BOTH the id and class selectors
I want to convert the IEnumerable<Target> of : public class Target { public Frame
I want to define a specific URL pattern using Sitemesh decorators.xml. I want to
I want to access a specific array's property by using a separate array as
I want to theme with css a specific button: the save or submit one.
I'm using Maven 3.0.3. I want to run a task to copy environment specific
Hello im trying to target a specific css background image here http://22twenty.com/This/ What i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.