Chi Shen Chi Shen - 1 year ago 73
CSS Question

Border do not cover image

enter image description here

Can anyone help me to bordered cover the image?

It only follow the text.
If my text is longer, then the border is resize with the text

Here my is html code

<div id = "guitar">

<img src="christmas.jpg" alt="guitar" width="500" height="300" class="imgleft"> </img>


Visit the three ghosts of Christmas this November as the PLAYHOUSE Whitley Bay kicks off the festive season with a fantastic Disney-esque musical production of A Christmas Carol.


Here is my css

#guitar { border : 5px solid;
padding : 10px;
margin-bottom : 2%;

Answer Source

You need to clear floated image. The simples way to do it is by applying overflow rule to container:

#guitar {
  border : 5px solid;
  padding : 10px;
  margin-bottom : 2%;
  overflow: auto; /* <--- this rule does the trick */
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download