css-float

toggling styles on label (active/focus) for input field with css only

不打扰是莪最后的温柔 提交于 2019-12-18 03:59:09
问题 Wondering whether if there is a css-only way to perform to toggle styles on the corresponding label on input's focus. So far I have: $(document).on('focus active', 'input',function(){ $('label[for='+$(this).attr('id')+']').addClass('active'); }); $(document).on('blur', 'input',function(){ $('label[for='+$(this).attr('id')+']').removeClass('active'); }); HTML: <div class="row"> <label for="contact_form_mail">Email</label> <input id="contact_form_mail" name="contact_form_mail" type="email"

CSS float, clear a “row” of floating elements

放肆的年华 提交于 2019-12-18 02:19:23
问题 I want to create a "scorecard" grid to output some data. If the data in each div.item is all the same height, then a simple float left on each div.item gives a nice even layout which scales up and down nicely depending on browser size. If the data however is variable, a different number of lines in each div, then the way elements float gives an uneven and messy output. See code sample below. If you create a page with the below, resize the browser to about 800px wide so that box 1, 2, and 3

CSS float, clear a “row” of floating elements

不打扰是莪最后的温柔 提交于 2019-12-18 02:19:02
问题 I want to create a "scorecard" grid to output some data. If the data in each div.item is all the same height, then a simple float left on each div.item gives a nice even layout which scales up and down nicely depending on browser size. If the data however is variable, a different number of lines in each div, then the way elements float gives an uneven and messy output. See code sample below. If you create a page with the below, resize the browser to about 800px wide so that box 1, 2, and 3

Input text auto width filling 100% with other elements floating

只谈情不闲聊 提交于 2019-12-17 23:34:40
问题 i have the following layout for a search box with: <div id="emulating_variable_width"> <form id="srxForm" method="post"> <div id="qsrxSearchbar"> <div id="scope"> Person Name </div> <input type="text" id="theq" title="Search"> <button id="btnSearch" type="button">Search</button> </div> </form> </div>​ (its very much simplified for showing purposes) The title in the 'scope' is a text that can be variable in length What i will like is to have the input text element to fill all available space

Why does an inline element accept width and height when floated?

倾然丶 夕夏残阳落幕 提交于 2019-12-17 21:08:04
问题 Now I have a span element I give it width and height for example 500px I know it inline element so it doesn't accept width and height but why it applies when I float it?? span.first { width: 500px; height: 500px; border: 1px solid #000; float: right; } span.second { width: 500px; height: 500px; border: 1px solid #000; } <span class="first">with float</span> <span class="second">without float</span> https://codepen.io/kemozzz/pen/KvVrXj 回答1: In accordance with CSS rules, when you apply float

Get the last div in a row of floating divs

China☆狼群 提交于 2019-12-17 19:32:27
问题 I have a number of divs floating in several rows. The divs contain text-previews and a link to slide down the full content (see http://jsfiddle.net/yDcKu/ for an example). What happens now: When you slide down the content-div it opens right after the connected preview. What I want to happen: Open the content-div after the last div in the row. I assume the could be done by: 1. find out which div is the last one in the row of the activated preview, 2. add an id to this div and 3. append the

Margin collapsing with floated element, why there is an extra margin added?

こ雲淡風輕ζ 提交于 2019-12-17 16:43:17
问题 Update : the below behavior is not visible on Firefox. Let's start with the following situation: html { background: red; } body { margin: 0; min-height: 100vh; background-color: green; } div { min-height: 50px; background-color: pink; margin-bottom: 50px; } <div></div> The body is defined with a min-height:100vh and we have a scroll bar that allow us to see the html . Here we are having a margin-collapsing , the margin of the div is collapsed with the body margin and thus create this space

How to vertically align floating divs to the bottom?

*爱你&永不变心* 提交于 2019-12-17 15:38:24
问题 Because examples rule: http://jsfiddle.net/rudiedirkx/wgue7/ How do I get the bars to the bottom instead of the top? Now they're sticking to the top of the container ( #bars ) but I want them sticking to the bottom. As you can see, I don't know the height of the highest bar, so I don't know the height of the container. These q+a don't help: Vertically align floating divs, Vertically align floating DIVs Should be simple, right? If it helps: it only has to work in decent browsers. PS. Number of

how to force horizontal scrolling in an HTML list using CSS?

此生再无相见时 提交于 2019-12-17 15:37:34
问题 I have a list like this: <div> <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ul> </div> and the following CSS: ul { width: 160px; height: 100px; overflow: auto; } li { width: 80px; display: inline-block; float: left } I'm trying to force the list items to display from left to right, that is one - two - three - four My problem: Doing it like this gives me two rows with two items each. Question: Is there a CSS way to force the list items to all be in a single row so I can use

CSS Floating Divs with different height are aligned with space between them

蹲街弑〆低调 提交于 2019-12-17 12:19:12
问题 i am using left floating DIVs to simulate a two column layout (each div contains textfield to edit different data, like name, hobbies,...). So it should look like this 1 2 3 4 5 6 Now my div-boxes aren't always the same, since some DIVs have more elements than the other ones. Now my layout looks likes this 1 2 2 3 4 5 6 You can also see the effect on this example if you scale your so that only four or three colums are shown. E.g. if 4 columns are shown in a row there is much space between