3 replies [Last post]
HolyMarcell
Offline
newbie
Germany
Last seen: 13 years 42 weeks ago
Germany
Joined: 2006-11-29
Posts: 3
Points: 0

Hello there and thanks for reading,

I have a problem with the HTML-Tag <br>;

I use the Border-property to make <p>-Tags look like Layers. So I need to use <br> to make a break, but if I want to add some other properies so multiple lines of text it does just work until the next appereance of <br>. The properties added to this <p>-tag are ignored, too.

Some code for you:

HTML:
(Stylesheet; Doctype are added)

<p class="layerC">
      txt<br />
      <span class="tab1">another text</span><br />
      <span class="tab2">some text</span><br />
</p>

CSS:

.layerC
{
	border-style: outset;
	border-width: 2px;
	padding: 10px;
	background-color: #ced6cc /*Gray*/
	font-family: "lucida console";
}

.tab1
{
	margin-left: 25px;
}

.tab2
{
	margin-left: 50px;
}

Feel free to ask if you did not understand my question. As being a german I have some problems with the IT-english. Wink

Greetings; Thanks in advance, HolyMarcell

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 39 weeks 3 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Leaving aside for a moment

Leaving aside for a moment the dubious semantics, you don't need any of the br elements in your example.

txt
another text
some text

Since you've classed the paragraph you have a hook for the rule

p.layerC span { display: block;}

Which will give the same effect without the br's.

Moving on to the semantics what are you actually trying to display here? You should write your content first, mark it up semantically, then style it. You are designing in a vacuum. The whole construction might be better done as a simple unordered list, and again you wouldn't need those extraneous brs.

The br tag is rarely actually needed and too many of them are a sign of a design gone astray.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

HolyMarcell
Offline
newbie
Germany
Last seen: 13 years 42 weeks ago
Germany
Joined: 2006-11-29
Posts: 3
Points: 0

Very thank you for your

Very thank you for your reply.

I am trying to display Some various code. For example HTML-Code. I did not post it, because it is mostly german text. I'll post some example and a graphic how it should look.

regards, HolyMarcell

HolyMarcell
Offline
newbie
Germany
Last seen: 13 years 42 weeks ago
Germany
Joined: 2006-11-29
Posts: 3
Points: 0

Heyho, very thank you for

Heyho,

very thank you for your piece of code. That helped me realizing, what I needed! I just left out the br-tag and as you guess the break was done by the CSS-code.

I would have never come to this solution for my own Wink again, THX.

regards, HolyMarcell
(Can be handled as a finnished topic; close or whatever you want)