Solved

How to make a span NOT break line while using display:block;

Posted on 2008-06-10
4
1,292 Views
Last Modified: 2011-10-19
Hi,

I'm beginner-level in CSS and I'm trying to do a fixed width class for a block (class bb in attached example) that will also NOT break the line so I can add a link on the right.

Yet, to have it at fixed width i have to use display:block but the only way i know to prevent line break is to put "display:inline", yet it cancels the display:block behavior and the class adjusts to the width of the text in the bb class...

it seems like a very basic question, however, no matter what search terms i try, there's no way I can find an answer to that on the Internet.

So my question is: how can I have a fixed width BB class and keep the following link on the SAME line.

Thanks

( see the attached sample )
ztest.txt
0
Comment
Question by:GizmoBlaster
  • 2
4 Comments
 
LVL 42

Expert Comment

by:David S.
ID: 21756998
Give the bb class float:left
0
 
LVL 9

Accepted Solution

by:
zemond earned 50 total points
ID: 21757002
set them both to float:left; in the css keep display:block; and then you can set there width,

The answer to the question that will follow this one is

after the floated objects do this

<div style="clear:both;"></div>

You'll know what I mean soon enough
0
 

Author Closing Comment

by:GizmoBlaster
ID: 31466026
Thanks guys.
0
 

Author Comment

by:GizmoBlaster
ID: 21761190
Thanks guys that worked well. Just for the record, the even simpler solution turned out to include the "clear:both" in the bb class, which spares me the trouble of adding a div.

Thanks again!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

25 Experts available now in Live!

Get 1:1 Help Now