So what exactly is the point in Matrix adding random divs in the source code and not only breaking my css based layouts but also making code less standards compliant???
Matrix doesnt add random DIVs. It writes DIV tags for each content div inside a bodycopy. Those can be changed to SPAN tags and also turned off completely. You just need to click the properties icon to change it.
As Greg says, each Bodycopy Div by default paints in "Block" mode, which adds <div id="<name of bodycopy>"> tags. By accessing the Div Properties dialog box, you can change this to Inline (<span> tags) or Raw (no tags).
Also, I'm unsure why this would break your CSS-based layouts -- the extra <div> tags would remain unstyled block objects, similar to any other block object in the content.
Just tried changing to raw and theres still tags "<div id="content_div_7379">"... why why why?
Ven, you have an example where a <div id="content_div_numberX"> is breaking your design? I've always appreciated Matrix using DIVs as the default block elements in the system…
Do a search for 7379. This will let you find the asset that needs to be set to raw. Remember, it could be a paint layout, a body copy, or a type format. All of those will write divs by default, and you have to turn these off.
Now you can take a deep breath!
I can think of a few places that my design has broken if I am not careful. If you are using a nested content area and you want to wrap it is a div, and you create a div content area above and below that to place them in, and don't turn those two div content areas to raw html, then they would write something like this and break your code:
<--Nested Content-->
Ok I take it I have to turn the content type to raw NOT the presentation type, in order to turn off these divs? That's a silly solution for people who want to use the simple editor to edit the content - the client does not have HTML knowledge! How else do i turn them off?
[quote]I've always appreciated Matrix using DIVs as the default block elements in the system...[/quote]
WHY?? I don't understand what the purpose is other than to make my life more difficult!
No, you need to turn the presentation type to RAW. The content type is the interface used for editing the content.
[quote]WHY?? I don't understand what the purpose is other than to make my life more difficult![/quote]
DIVs are standard HTML elements used to group components on a page and allow you to apply styles for presentation and layout using the ID of the DIV. Having DIVs on the page doesn't cause problems as you can style them to remove padding. Not having them means you would need to manually enter them in Raw HTML mode every time you want to style your content.
No -- the Presentation Type determines whether or not Matrix wraps <div>, <span> or nothing around the content. The Content Type is the style of editor that we use. You need to search for asset ID 7379 to switch that particular bodycopy into Raw Presentation mode.
Also, the example you give isn't correct (or shouldn't be): Matrix always wraps <div> tags around discreet pieces of code, so I'm not sure why there would be opening and closing <div> tags in the middle of it all. Given this Design example:
Matrix would produce this HTML:
[html]<div id="nested_content">
<div id="content_div_111">
<p>This is my nested content</p>
</div>
</div>[/html]
Which is perfectly valid and shouldn't impact your CSS layout in any way.
The only standards compliancy issue is with repeated id tags with nested content - you need to turn off the divs there (hey that could be the default for type formats usefully though!).
You shouldnt really write your CSS to depend so exactly on the direct way tags are nested or you will run into issues with users (or designers) adding more tags - using "div div div ul" differently from "div div ul" is not going to be robust long term; you should be using a few classes carefully.
Just a note that in type format DIV IDs you can use keywords for the current asset, just like you do in content. So you can inject the ID of the asset being listed into the DIV ID to make it unique, if you want to keep DIVs.
If you add a random DIV with a random ID and it breaks your CSS you've probably got some wider CSS issues with your styling which are never going to degrade well in Matrix. Would love to see an example of your stylesheet and where it breaks the design!
[quote]The only standards compliancy issue is with repeated id tags with nested content - you need to turn off the divs there (hey that could be the default for type formats usefully though!).
You shouldnt really write your CSS to depend so exactly on the direct way tags are nested or you will run into issues with users (or designers) adding more tags - using "div div div ul" differently from "div div ul" is not going to be robust long term; you should be using a few classes carefully.[/quote]
Yes exactly the compliancy issue i was referring to - so why can't matrix produce classes instead of ids?
Anyway it was my paint layout so thanks to whoever it was that pointed that out
Also thanks for the CSS tip but there was a reason for the way my styles were written - to do with using only 1 design template but different classes according to the page - too long to explain on here anyway. I have now changed the stylesheet though it has added more markup to it
That's a standard thing with any CMS really. You have to design CSS for system elements, not for specfic pages. Hence the reason many Matrix sites run on 3 or more stylesheets simultaneously.