the ieee std 802.1d, 1998 edition does not take into account vlans when it calculates stp information — the calculations are only performed on the basis of physical connections. for this reason, some network configurations can result in vlans being subdivided into a number of isolated sections by the stp system. therefore, you must ensure that any vlan configuration on your network takes into account the expected stp topology and alternative topologies that may result from link failures.
for example, figure 13 shows a network containing vlans 1 and 2. they are connected using the 802.1q-tagged link between switch b and switch c. by default, this link has a path cost of 100 and is automatically blocked because the other switch-to-switch connections have a path cost of 36 (18+18). this means that both vlans are now subdivided — vlan 1 on switch units a and b cannot communicate with vlan 1 on switch c, and vlan 2 on switch units a and c cannot communicate with vlan 2 on switch b.
figure 13 configuration that separates vlans

to avoid any vlan subdivision, it is recommended that all inter-switch connections are made members of all available ieee 802.1q-1998 standard vlans to ensure connectivity at all times. for example, the connections between switches a and b, and between switches a and c should be 802.1q tagged and carrying vlans 1 and 2 to ensure connectivity.
for more information about vlan tagging, see chapter 8 “setting up virtual lans”.