3

CSS Attach container and overflow elements

 2 years ago
source link: https://www.codesd.com/item/css-attach-container-and-overflow-elements.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

CSS Attach container and overflow elements

advertisements

Iam wondering if it is a way to force overflow elements of an fixed container to be on the same line instead of going on a new line.

http://jsfiddle.net/vrSRE/3/

Thank you.


Yes, there's a way.

You have to replace, float: left with display: inline-block, and add white-space: nowrap to the parent element:

See: http://jsfiddle.net/vrSRE/4/

ul {
    width: 300px;
    height: 30px;
    background: red;
    white-space: nowrap
}
li {
    display: inline-block
}

If you don't want any space between the elements, the easiest way to fix this new problem is to remove the whitespace in the HTML, like this:

For other options that you probably don't care about to remove the space, see:

  • How to remove the space between inline-block elements?

And lastly, if you care about IE7 support, use this:

Related Articles

CSS left float and position elements

I have problem with float left , i use container widt 900px of size and inside have the elements for show 4 elements by line , the structure no give me problem , but if i use diferent height in one element , the element under no show right , i put my

Applying CSS to Label and Input Elements Using Values ​​in jQuery

Edit : I am aware that their is a question mark in the jQuery, CSS and HTML. Due to it being generated automatically by Yii I cannot remove it. Using jQuery I am attempting to add and remove styling to an input and label within my HTML. I get no resp

CSS float: left and overflow: visible section of the text

I'm currently trying to make a color gradient in javascript with numerical values in some of the divs to represent as the scale. However, I've noticed with larger values, the numbers get cut off due to the float:left. I've also tried used display:inl

How to align two divs side by side using floating, clear and overflowing elements with a fixed position div /

So I've been trying to align two divs side by side without overlapping. I have one div which will be fixed as a sidebar and the right div as the content. Hopefully, someone can help me. HTML: <div id="wrapper"> <div id="leftcolumn&

CSS: vertical centering and overflow content

I'm using the verticle centering code from http://css-tricks.com/centering-in-the-unknown/ The problem is that when the content gets longer, it will get out of box rathern than break the line. <div class="reach align-middle"> <div class

Fluid arrangement Css with fixed and reactive elements

I have this layout: <div id="wrapper"> <div class="prev"></div> <div class="pause"></div> <div class="seekbar"></div> <div class="next"></div> <div

Problem with overlapping and overflowing elements

I have this script. Element with class "help" and id "help" overlap each other. I want with hover on ".help" the "#help" show. But when click on ".onHelp" the "#help" couldnt close. What is solut

Hide a container and show another

I have a container and three elements inside it. I need to hide .short-post, show .long-post and modify the parent width. .container, .short-post, .read-more { display: block; } .long-post { display: none; } .read-more:active > .short-post { display:

Why Overflow: Hidden widens the parent element (containing floating child elements)?

In short: Basically, I just want to know why overfow:hidden explands the container containing a floated item. Shouldnt it hide the overflowing element like in this image http://css-tricks.com/wp-content/csstricks-uploads/css-overflow-hidden.png why d

CSS first child and last child do not work when used on the same element

I just noticed that CSS :first-child and :last-child don't work when used on the same element. Only one is used. I'm wondering why is that and if there is any workaround to that in CSS? It seems like CSS bug to me - first element can be also last ele

When a Flexbox element has a packaging text, the element fills the container and has an extra white space at the end

Using a flexbox layout, I have a container with three divs in it. What I'm going for is the first div hugging the left edge of the container while the remaining two divs snuggle up on the right edge of the container. I'm admittedly very new to using

Use an image name contained in an element - XML ​​/ CSS

I am making a CSS file for an XML document. I need to insert an image - the filename of which is contained inside an element. This is part of the xml code I am referring to: <description> <text> Club Praia is divided and linked by a foot bridg

How can I use CSS to select and classify all LI elements that have UL sub-elements?

Possible Duplicate: Complex CSS selector for parent of active child I'm making a CSS context menu and I want all list items that have submenus to be styled differently to visually represent to the user that they have submenus. The context menu is a U

Attach a header to the top of a container with overflow: Automatic;

I have some content inside an overflow: auto; container: https://jsfiddle.net/h4y37qwu/ <div class="container"> <div class="header"> </div> <div class="content"> </div> </div> CSS .containe

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK