在div中发出样式文本

时间:2014-03-12 20:40:16

标签: html css

在我的网页上设置一些文字样式时遇到一些问题。我想缩进整个文本8像素,而不只是第一行。我还想更改文本的整个字体和大小,而不仅仅是第一行。网页上的文字可以在jbussey.co.uk/bobbin/bridal.html查看,我的css代码如下所示。任何帮助深表感谢。感谢

<div id="othermain"><p>
Is your big day approaching? Need a Wedding Dress, Bridesmaid Dress or any Bridal Wear altering or remodelling? You are definitely looking in the right place, this is our speciality! <br><br> At Bobbin Alterations, 
we want to make sure that your dress is the perfect fit and style for you, for your special occasion. whether it be a Wedding, Prom, a dinner or any other special occasion. We understand that planning you're
big celebration can be very demanding at times, but we're here to take your worries away and make it as stress free as possible.<br><br> Looking good and comfortability is crucial, and with our help, we can tailor and alter a dress the highlights your features and make you feel wonderful.
    <div id="testimonial"></div>
    <br><br>Our standard dress alterations include:<br>
    <br> - Shortening
    <br> - Seams
    <br> - Hemlines
    <br> - Beading
    <br> - Shoulder Adjustments
    <br> - Straps
    <br> - Veils
    <br> - Zips<br>
    <br>We've had the privilege of helping with endless amounts of weddings and proms and take extreme pride in the happiness that is made through our work.<br>
    <br><br>Use the Order form to place an order, or call us on 01325 59976 with an Enquiry, to guarantee a First Class service and a truly memorable occasion.
</div>

#othermain{
    width:1024px;
    height: 480px;
    background-color:#FFFFFF;
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
    -moz-border-radius: 10px; /* for firefox */
    -webkit-border-radius: 10px; /* for safari & chrome */
    border-radius: 10px; /* for others (opera) */
        }
p {text-indent:8px; }

1 个答案:

答案 0 :(得分:1)

p {text-indent:8px; }

以上text-indent可以删除。此属性特别适用于缩进第一行。如果您不想/不需要,可以将其删除并改为使用填充。

您只需在容器中添加填充。例如

#othermain { 
  padding: 10px;
}

这将在所有面上添加一个填充,使内容很好地保持在圆角内。

当然,您也可以在一侧添加特定填充。例如:

#testimonial {
  padding-left: 20px; /* Indent this block a little more */
}

作为一般提示:您也可以使用课程。您可以使用#main1 {打开而不是.main {(请注意时间段)。这样,您可以声明样式并多次使用它。对于需要黄色背景和圆角的每个块,您可以添加相同的类。这样你的CSS将更加通用,并且(我认为)更具可读性。