Solved

Style sheets: Inline boxes

Posted on 1998-09-05
5
267 Views
Last Modified: 2010-04-09
I will increase points to 85 if you have a working answer:

Understanding of course, that netscape and IE have limited and varying implementations of CSS, I have the following question: I want to make a line of text which contains an inline box with a border followed by regular text. Here is my CSS code:

P {
font-size: 12pt;
line-height: 14pt;
text-align: left;
vertical-align: top;
font-family: geneva,verdana,tahoma,arial,helvetica;}

EM { color: red;
border-style: groove;
border-width: thick;
border-color: red; }

And here is my HTML code:

<P>Here is some text <em>contained within </em> a block of text</P>

What I get in netscape is three lines of text, the middle one (<em>) has the border of course. Now, how do I get these on one line and not three?
0
Comment
Question by:65471
5 Comments
 
LVL 10

Expert Comment

by:MasseyM
Comment Utility
I don't even get the border in mine..  All I get is the red tet.. (all on one line) -- IE 4.01

0
 
LVL 6

Accepted Solution

by:
ckayter earned 30 total points
Comment Utility
Rather than using <em> tags, try defining the border in a span class.

In your CSS file:

SPAN.em { color: red; border-style: groove; border-width: thick;
border-color: red }

In your text:

<P>Here is some text <SPAN CLASS="em">contained within </SPAN> a block of text</P>

I'm not sure HTML will permit you to put a border around a group of characters within a line, but if you can, this is how it would be done.

Colleen

0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
I looked into Colleen's suggestions and they don't work in Netscape...  I'm not sure if there is a control for this that will work in Netscape 4.0-4.05 (maybe 4.06 fixed it?) but I suppose a workaround could be to use tables forcing them to occur on the same line...  something like this:
<html>
<head>
<style type="text/css">
SPAN.em { color: red; border-style: groove; border-width: thick;
    border-color: red }
</style>
</head>
<body>
    In your text:

<TABLE cellpadding=0 cellspacing=0 border=0><TR>
<TD vali>Here is some text </TD>
<TD><SPAN CLASS="em">contained within</SPAN> </TD>
<TD>&nbsp;a block of text</TD></TR></TABLE>
</body>
</html>

-Josh
0
 

Author Comment

by:65471
Comment Utility
Thanks kcarter, but I tried that previously. It's not that you were wrong per se, the CSS 2.0 spec allows that. It's just that Netscape and IE aren't yet fully border savvy. I think jbirk's answer is the best way for now. Although, I had hoped to avoid that. But, I'll give kcarter some points and if jbirk wants any, he can email me to resubmit the question.
0
 
LVL 8

Expert Comment

by:jbirk
Comment Utility
That's ok, just happy to help... err...  well sort of.

Best of luck!
-Josh
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now