Jump to content
  • 0

Откалибровать содержимое дива


Paris
 Share

Question

Всем привет )

 

Начинаю разбираться с css. Есть необходимость выровнять содержимое дива .logo_bg_right с теми значениями паддинга, что указаны в коде, а именно 13px 18px. В принципе если поменять значение паддинга слева-справа на 14px получается...

 

Если оставить 18px и приглядеться видно отступ с правой стороны. Не пойму откуда он взялся(

Самое удивительное, что код абсолютно одинаков)

<!DOCTYPE html><html>    <head>        <title>Project Name</title>        <meta charset="utf-8" />        <link href="main.css" rel="stylesheet" type="text/css" />    </head>    <body>        <div class="header">            <div class="logo_bg_left">                <p class="logo_text_left">                    Текст должен быть слева                </p><!--logo_text_left-->            </div><!--logo_bg_left-->            <div class="logo_bg_right">                <p class="logo_text_right">                    Текст должен быть справа                </p><!--logo_text_right-->            </div><!--logo_bg_right-->        </div><!--header-->    </body></html>
* {    margin: 0;    padding: 0;}body {    background: #E0E0E0;}.header {    height: 100px;    width: 950px;    background: #2A3646;    margin: 15px auto;    border-radius: 3px;}.logo_bg_left {    float: left;    width: 250px;    height: 50px;    background: #083C82;    margin-top: 20px;    margin-left: 4px;    border-radius: 15px;}.logo_text_left {    color: #D4CC86;    font-size: 16px;    font-family: Verdana, sans-serif;    padding: 13px 18px;}.logo_bg_right {    float: right;        width: 250px;    height: 50px;    background: #395E2D;    margin-top: 20px;    margin-right: 4px;    border-radius: 15px;}.logo_text_right {    color: #D4CC86;    font-size: 16px;    font-family: Verdana, sans-serif;    padding: 13px 18px;}

Буду рад любым советам. Спасибо.

 

http://jsfiddle.net/sx6Lyduh/

Edited by Paris
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

<p> занимает всю ширину род. блока logo_bg_left, у которого проставлено 250px.

Ставим последнему width: auto и все получается.

Если хочется, чтобы p занимал места по содержимому - думаем в сторону inline-block или float

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy