Is this considered unprofessional?

Discussion in 'HTML & Website Design' started by red-sky, Mar 31, 2009.

  1. #1
    I have a feeling it is, I have been coding like this for a while and always frowned upon it. Basically, if I have a rounded rectangle, and I want to chop off the top and the bottom to have 3 images:

    Top.png
    Body.png
    Bottom.png

    What I want to do is show the Top.png, repeat the Body.png on the y-axis (repeat-y) and use the Bottom.png to close it off. At the minute I've got this

    HTML

    
    <div id="Body">
    	<div id="Top" ></div>
    		<div id="Body" >
    			<p>Hello</p>
    			<p>Hello</p>
    			<p>Hello</p>
    			<p>Hello</p>
    			<p>Hello</p>
    			<p>Hello</p>
    			<p>Hello</p>
    		</div>
    	<div id="Bottom" ></div>
    </div>
    
    Code (markup):
    CSS

    
    #Body{
    	float: left;
    	text-align: left;
    	width: 720px;
    	height: 100%; 
    	padding-right:30px;
    }
    
    #Body #Top{
    	float:left;
    	width: 720px;
    	height: 30px;
    	background-image: url("images/Body-Top.png");
    	background-repeat: no-repeat;
    	display: block;
    }
    
    #Body #Body{
    	float:left;
    	background-image: url("images/Body-Body.png");
    	background-repeat: repeat-y;
    }
    
    #Body #Bottom{
    	float:left;
    	width: 720px;
    	height: 30px;
    	background-image: url("mages/Body-Bottom.png");
    	background-repeat: no-repeat;
    	display: block;
    }
    
    Code (markup):
    Surley there's a much better wau to code it than this? I have searched for a while now and have never come across anything. Anyone care to shed some light...

    Thanks
     
    red-sky, Mar 31, 2009 IP
  2. eugen

    eugen Active Member

    Messages:
    154
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You could optimize Top & Body into one single element.
     
    eugen, Mar 31, 2009 IP
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Do you always have multiple paragraphs? You could do something like

    <div id="rounded">
    <p>text</p>
    <p class="last">some more text</p>
    </div>

    Then assign top background to #rounded
    repeating background to p
    and bottom background to p .last

    Then fiddle with the margins and everything obviously so it all looks pretty. If you have any other elements hanging around you could use them.
     
    wd_2k6, Mar 31, 2009 IP