If you haven't read our post on this actual code, you can view Part 1 of this series here.
First, let's cover the basics of how CSS works. When you see the "" tag, that means that everything between the two are overriding the default html tag's display features. For example, w3schools has a set of default style values such as font-weight: bold, and font-size: 20pt (or so). In order to override that in css, we'd do something like this:
HTML:
-
h1 { font-weight: normal; font-size: 12pt;}
Note that we start by declaring a new style "". Then, we declare which tag we want to change "h1", followed by an open curly bracket "{", a list of style settings, then the closing curly bracket "}" implying the end of our new styles.
Now our style sheet has overridden the default value for h1 tags throughout the document, and will be reflected everywhere you have a
...tag set. Now, we can create "classes" and "id's" in css that allow us to use custom styles. For example, myspace uses a custom css class which they titled "contactTable". In the html, they represent this with the following tag:
HTML:
-
<i><span class="contactTable">"... some crappy images ..."
</span></i>
In our myspace style code above, you'll see something like the following code:
HTML:
-
<i><style type="text/css"><br /> .contactTable {display:none; height: 0 !important; visibility:hidden; }
Note the "." before the "contactTable" title. This tells the css to look for contactTable as a "class", as opposed to a custom "id", or a built-in CSS tag. Also, you'll notice that what we're doing with this tag is essentially just squashing it into nothing. That's because the purpose of this code is to HIDE everything. There are TONS of code samples out there to show you how to change the background, colors, etc. And if we have time, we'll add some of that here, but for now, we're just "turning it off".
This is a great time to interject that it would be HUGELY beneficial to both the users of myspace AND myspace themselves for THEM to give you the option of turning off sections of data like this, as it could GREATLY reduce bandwidth on their part. However, they're dumb, and you're not, so let's continue to give you more responsibility and control. That's why you're here, right?
Now that you're a CSS master (it's really that simple), let's look at this code again and break it down line-by-line.
This first section of code turns off ALL FLASH CONTENT.
HTML:
-
embed, object {display:none;}</style></i>
So, if you do end up with some div overlay layout, and you want to add say, a youtube video embed in your profile, just add a style attribute to the object tag, like so (added code in bold):
HTML:
-
<i><span class="mceItemObject" type="application/x-shockwave-flash" data="http://www.youtube.com/v/TTV0Aa4lC04" height="350" width="425"<b> style="display: inline;">
</span></i> <span name="movie" value="http://www.youtube.com/v/TTV0Aa4lC04" class="mceItemParam"></span> <span name="allownetworking" value="internal" class="mceItemParam"></span> <span name="allowScriptAccess" value="never" class="mceItemParam"></span> <span name="enableJSURL" value="false" class="mceItemParam"></span> <span name="enableHREF" value="false" class="mceItemParam"></span> <span name="saveEmbedTags" value="true" class="mceItemParam"></span> <span name="wmode" value="transparent" class="mceItemParam"></span>
Now, back to the code. Next, we turn off the myspace-generated custom tags. This way, we have direct access to every instance of the use of any of these tags, and we don't have to "target" them, which I'll explain in a second. So, in order to save ourselves from writing the same code over and over again for every class we want to turn off, we simply list them, separated by commas, and then apply a style, like so:
HTML:
-
<i>.contacttable, .whitetext12, .nametext, .lightbluetext8, .orangetext15, .blacktext12,.btext, .redtext, .redbtext{ display:none; height: 0 !important; visibility:hidden; }
</i>
If we want to "target" an instance of a tag, say for example that we want to only change an h1 tag if it appears in a nest of other tags like so,
...then we would address it in css like so:
HTML:
-
<i>table tr td div h1 { ... some styles }
</i>
You'll notice that we don't have any commas separating our list this time, which tells CSS to "target" the h1 tag when it's nested in a div, which is nested in a table details, which is nested in a table row, which is nested in a table.
NOTE: "nesting" means that tags are opened, then other tags are opened, then the second tag is closed, then the first tag is closed. Like this:
HTML:
-
<parent><child></child></parent>
In this example, the "Child" tag is "nested" inside of the "Parent" tag. Make sense? Good. Glad you're following.
Having said that, you'll see LOTS of targeting in all the millions of bits of myspace code around the myspace'o'sphere. Don't be intimidated. It's a result of a VERY badly designed site (myspace), and the sheer power of a well-written code base (CSS), blended with the determination of a creative user (You). Fighting the system, and getting what YOU want, you continue your code with the following:
... when td's are nested 4 deep...SUCH AS:
HTML:
-
td td td td { border:0px; width:0px; text-align:left; }
... all table and td tags... SUCH AS:
HTML:
-
table, td { padding:0px;width:;background-color:transparent}
... when tables are nested 3 deep... SUCH AS:
HTML:
-
table table table { padding:1px; height:.01%; width:100%;}
... tables nested 2 deep, tables nested 4 deep, table, tr, and td tags... SUCH AS:
HTML:
-
<i> table table, table table table table, table, tr, td {height:0px;!important;border:0px;!important}
</i>
... tags that have "class=text" in them, when tags are nested in font tags which are nested in div tags which are nested in a table, when a font tag is nested in any tag containing a "class=navbar" attribute, when a font tag is nested in a td which is nested in a tr ...SUCH AS:
HTML:
-
<i> a.text, table div font a, table div div, .navbar font, tr td font { visibility:hidden; display:none; height:0px;!important;}
</i>
... tables nested 4 deep, td's with "class=text" nested in a table nested 4 deep, tables nested inside of 2 nested td's which each contain "class=text" attributes ...SUCH AS:
HTML:
-
<i> table table table table,table table table table td.text, td.text td.text table { display:none;}
</i>
... table tags nested 2 deep inside of td tags with "class=text" attributes ...SUCH AS:
HTML:
-
td.text table table { display:inline; visibility:visible;}
... table tags nested in td tags with "class=text" attributes nested in a tr tag which is nested in a table tag which is tested in a td which is nested in a table ...
SUCH AS:
HTML:
-
table td table tr td.text table { visibility:hidden;}
... tables nested 2 deep inside td tags with "class=text" nested in tr tag which is nested in a table which is nested in a td which is nested in a table ...SUCH AS:
HTML:
-
table td table tr td.text table table, table td table tr td.text table table td.text { visibility:visible;}
And of course, we close the style...
[html][/html]
Now that you're a CSS guru, go and hack the hell outta your myspace page. I'm sure we'll be posting again soon on how to do even more. For now, enjoy.
Your Friend and Mine,
Meshach