1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

stupid CSS issue

Discussion in 'HTML, Graphics & Programming' started by AHarvey, 17 Jun 2015.

  1. AHarvey


    Joined: 6 Mar 2008

    Posts: 10,021

    Location: Stoke area

    Hi all,

    I have a silly issue with a div and my brain is just overloaded with info so I can't seem to figure it out.

    Text sits on the edge of the border, so you add padding-left of 5px to move it away. This then has the issue of adding 5px to the total width of the div meaning that it now sticks out slightly further than the one above and below.

    text-indent only works on the first line of a text block.

    It's a responsive div so set to 100% so can't subtract it from the total width.

    Am i being stupid here and completely overlooking something?
    Last edited: 17 Jun 2015
  2. Flanders


    Joined: 2 Nov 2004

    Posts: 571

    Location: London, UK

    Have you tried adding the padding to the embedded element e.g. <p></p>?
  3. Dup


    Joined: 10 Mar 2006

    Posts: 10,391

    Location: East Lancs

  4. kaku

    Wise Guy

    Joined: 21 May 2013

    Posts: 1,891

    box-sizing: border-box;

    This makes it so your block element will always be the specified width INCLUDING padding, borders, etc.

    edit: snap, above xD