The <div style=" and the <span style=" are two different parts, is there a name that each is called?

I don’t understand what you mean.

I don’t know how many more ways I can explain it.

font-family: "Times New Roman", serif;

is correct. If you use external style sheets, as we keep recommending, that is all you will ever need and it will work. If, however, you use inline styles, you will run into problems.

style="font-family: "Times New Roman", serif;"

You can see from the way the highlighting has changed that it’s regarding "font-family: " and ", serif;" as the quoted strings, which makes no sense, so it won’t work. You need to use a different type of quote to allow it to match the pairs correctly:

style="font-family: 'Times New Roman', serif;"
1 Like

Example 2, you can do it this way:
<h1 style="font-family: 'Times New Roman';">Heading</h1>

Yes. That’s exactly the example I just gave you above (except that you haven’t given the full code for context).

1 Like

‘Enjoy the music’ isn’t a fragment it’s a sentence and in html we used paragraphs tags to mark up sentences.

Enjoy’ is a fragment of that sentence; ‘the’ is a fragment and ‘music’ is s fragment. The whole thing is a paragraph as far as html is concerned. Some may argue that short phrases are not paragraphs but when they stand on their own merit they are indeed paragraphs (at the very least they would be divs and not spans because you would want natural line-breaks).

In truth ‘Enjoy the music’ is likely to be a heading of some sort and a heading tag should be used but as we have no context then we are guessing again. It will however never be a span.

For ‘enjoy the music’ to be marked up as a span you would need a structure like this.

<p>It was a long day and it was finally good to turn on the CD and <span>enjoy the music</span> at last.</p>

2 Likes

We need the context before we can answer that as there is no one right answer for all occasions.

Many times stand alone text is in fact a heading of some sort and a heading tag at the appropriate level should be used.

Otherwise I always mark up short phrases and indeed single words as paragraph tags because that makes more sense than using a div which is primarily for divisions of content.

You have to look at the context and ask what is the text doing and what does it imply and then use the most semantic tag for the purpose in hand. Semantics can be debated and some people mark odd words in divs (instead of p) when they stand alone but as mentioned before they will never be marked up as spans because that is incorrect.

1 Like

What if I need to use, display:table? you can’t use <p style=" with table? I should use div instead in that case?

Why not?

But rather than “What if I need to use…?”, it would be much more productive if you said what you actually want to do with this, including giving us the full content you intend to include in this section, and allow us to suggest the best approach to use.

Constantly asking half-questions, and then “moving the goalposts” by changing conditions (apparently at random) is not a good way to learn, and is certainly not a good way to encourage people to assist.

2 Likes

This is what happens when you use table and div vs table and p.

This is because: a paragraph cannot contain any other block elements, which includes tables.

With that being said, if I need to use div instead of p is that fine, cause I was told not to use span for fragments. I was told to use p instead, but I can’t use p, cause I need to use a table.

If I’m saying something that’s incorrect please tell me.

no- you have been told not to use a <table>

CSS is completely separate from HTML but you don’t seem to even be aware that they are two different languages as you have not yet made any attempt to learn either one but just keep asking what we think of your latest JUNK.

If I don’t use table then what will I use to ensure that the border wraps with the text? Without table the border doesn’t wrap with the text.

That statement makes no sense whatever.

Borders go around block elements - they never wrap with the text as they have nothing whatever to do with the text.

4 Likes

Can you show me exactly what you mean, cause I don’t understand what you’re saying, and I want to understand, and I want to set this up correctly. https://jsbin.com/narofemane/1/edit?html,output

What was wrong with the code that @PaulOB wrote? You know, the code with the blockquote tag? That was perfect for a quoted block of text ??? :puzzled:

2 Likes

I don’t like the style of it, it doesn’t flow with my layout. Like the one I made.

PaulOB told me I should be using p instead, but you can’t use p and table cause it won’t work. I need to have table so that the border wraps with the text. And in order to use table I have to use div instead of p.

  1. table div and p are completely separate and represent different things.
  2. What you have is most closely identified as a paragraph and so that’s how you should mark it up in the HTML - how it looks has no effect on the correct HTML to use as all that can be changed by the external CSS.
1 Like

I hear ya.

<BadCat Question #1>
Are you writing our pay check?

It is not our charge to guess and guess about how you want your page to look. The onus is on YOU to show US how your page should look and the code that you are using because WE want to help YOU to understand and WE want to help YOU to set it up correctly.

2 Likes

Am I allowed to set it up like this? Is there anything wrong with doing it like this?

Using display table with display inline?

<div style="display:table;background-color:black; width: 605px; height:68px;padding-left: 1px">

<p style="display:inline; font-family: 'Times New Roman'; font-size: 16px;color: white; "><q>Never let society to turn you into a grain of sand on the beach. Be different, be individual. Refuse to look alike with others. Leave your herd, only then you will have a real name and till then your name will remain as the grain sand.</q> ~ <em>Mehmet Murat ildan</em></p></div>

I am 100% sure that we have mentioned several times that one should use semantically appropriate tags, AND equally positive that @Gandalf and everyone else has said that one should NOT use an inline element such as a span and style to be behave line a block, nor should one use a block element and style it to behave like an inline element when you can use the correct tag without changing the display properties.

Why did you choose to assign {display:table} to the outer element? What property or behavior does a table offer that another block element such as an native <div> or <blockquote> does not?

And why assign {display:inline} to a <p> element? It simply isn’t appropriate.

2 Likes