locked
Cleaning Old Code, Understanding how to Fix Old FP pages, Best Practices RRS feed

  • Question

  • I have a lot of little questions that have arisen as a result of redoing an old FP site. 

    Here is the page in question: http://www.brookhavenhospice.com/.  Some of the questions I ask might not be related to what you see on this page.

    1.) I have a div called main content and the best way I can describe what I want to accomplish here is to describe it as a 2x2 table with the top left cell holding Text, the top right cell holding an image and the two bottom cells holding text and a small image. If you were doing this from scratch, would you create a div that holds 4 divs inside?

    2.) Is there an easy way to get rid of old FP code on a page so I can start fresh.  I deleted all inline styles but I'm still seeing code similar to this: class="style30"

    3.) How do you remove a style from a picture without deleting the picture?


    Tony

    Friday, March 30, 2012 1:39 PM

All replies

  • #1 – Yes.

    #2 – No. Well, actually, define "easy." Seriously, EW has a powerful and flexible search function, and assiduous application of "standard" search and regular expression searches and get rid of a lot of junk. OTOH, to an experienced, knowledgeable developer, using a tool like EW, it truly would be easier, and faster, to simply rebuild the page(s) than to try to clean them up. I mean, you've already got the design determined, the basic layout, the color scheme, and the content is available. Shoot, that's 80% of what you need to build a site, the rest is just implementation. Given those elements, I or any other experienced developer can reproduce any static page you can point to in no time.

    So, the answer is subjective. If you have the requisite knowledge, and the tool(s) to apply it, a rebuild is probably faster and "easier." If not, "fixing" deprecated markup may be be easier, as well as being something of a learning experience as you go through the process. Your call... ;-)

    #3 - Depends. How was it applied? Seriously. First, there's no reason to delete the image no matter how the style was applied. If the styling is inline, simply delete the style attribute part of the element's declaration. If it is applied via a selector in a <style></style> block or external style sheet, it depends on the selector, how specific or universal is it? The more specific, the easier. If an id selector, it only applies to one element, and you simply delete it. If a class selector, simply remove the class assignment from the image in question, and the rule(s) no longer apply to that image. If it's a universal selector, an element selector such as "img," then to eliminate the effect of the rule for an individual image, you must either do so for all affected images, or create another, later or more specific rule, which applies to that image. So, if you have

    img {
       border:0;
    }

    And you want to add a border to one image, you can either do so inline in a style attribute in the image's declaration, or you can create a higher specificity selector to override, like so

    img#red {
       border:2px solid red;
    }

    Then you would assign an id of "red" to that particular image, and that image and only that image would have a red border.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Friday, March 30, 2012 4:23 PM
  • Thanks for your response!

    Tony

    Friday, March 30, 2012 5:53 PM