I have a fixed-width DIV that floats left, with the main content just beside it. When I resize the window, instead of a horizontal scrollbar I see the main DIV jumping downward below the floating DIV, i.e. the "floating" effect disappears.
A demo is available here:
http://jsfiddle.net/rustamabd/Xygn2/
How do I tell the browser that I always want to see both DIVs side-by-size, but without having to set min-width on the main DIV (I want the tables in the main div to squeeze as much as possible before the scrollbar appears).
Is it necessary to have two elements with class "main"? By changing the class name of your text div to "mainBody" I was able to get what you want with this...
.main-left {
float:left;
}
.left-block-1 {
width: 160px;
height: 400px;
background-color: grey;
}
.mainBody {
left:175px;
width:400px;
position:absolute;
}
.body{
overflow:auto;
}
So the html from the edited fiddle is...
<div class="main">
<div class="main-left">
<div class="left-block-1"></div>
</div>
<div class="mainBody">
Block-1
<br>
QWERTYUIOPASDFGHJKLZXCVBNMQWER
<table>
<tr><td>A B C</td><td>A B C D E F G H I K L M O P Q R S T U V W X Y Z</td></tr>
<tr><td>A B C</td><td>A B C D E F G H I K L M O P Q R S T U V W X Y Z</td></tr>
<tr><td>A B C</td><td>A B C D E F G H I K L M O P Q R S T U V W X Y Z</td></tr>
</table>
</div>
</div>
If you want to make the layout responsive, you must use percentage unit. And use word-wrap:break-word; to make the text go to the next line
Live demo
Otherwise, you need to use overflow:hidden; but this will truncate the word when it needs more space
.main{
overflow:hidden;
}
Live demo
Related
Here is the website and the part where im having issues
https://kas-test.000webhostapp.com/volonteri.html
Top part where i used inline tag works but its not in center like the bottom part, also on kontakt.html.. everything is off its course while when i run the same code on localhost everything looks fine..
Here is picture of localhost:
Its perfectly in center.. why?
I DO recommend to you start using a grid system (bootstrap has a good one). Also blockquote isn't a good way to make a "left border", you can accomplish it by using border-left: 5px solid black
But if you only want to "hotfix" your code, you can update it by doing:
.inline {
display: inline-block;
width: calc(50% - 30px); // new
max-width: 500px; // new
margin: 15px;
float: left;
}
blockquote {
text-align: justify;
border-left: 5px solid black;
border-radius: 3px;
padding-left: 20px; // new
}
Cheers,
Try this instead:
<blockquote>
<div style="padding-left:30px;">
‘‘Sveukupni rad i funkcioniranje udruge bazira se na radu volontera. Volonteri su jedna od najvažnijih i nezaobilaznih karika u cjelokupnom programu rada udruge. Minimalna dobna granica volontera za uključivanje u rad udruge je 14.godina. Nakon što izrazi želju da želi volontirati, volonter ispunjava pristupnicu te nakon toga potpisuje volonterski ugovor gdje su regulirana prava i obaveze volontera, te dobiva volontersku knjižicu u koju se svake godine upisuju odrađeni sati volontiranja. Volonteri su dužni držati se svim pravila i propisa o ponašanju što je definirano u volonterskom ugovoru. Volontirati se može na više različitih načina a najčešći su uključivanje u provedbi terapijskog jahanja, pomoć oko skrbi za konje, pomoć kod održavanja rekreacijskog jahanja, pomoć pri čišćenju i održavanju okoliša i opreme, sudjelovanje na raznim kulturno-zabavnim manifestacijama na kojima udruga sudjeluje, pomoć oko promidžbe rada udruge, konjičkog sporta, reklamiranja, upoznavanja građanstva s aktivnostima udruge itd. Ovisno o potrebama i mogućnostima organiziraju se radionice za volontera gdje se obučavaju i osposobljavaju za što efikasniji rad. Više puta kroz godinu organizira se druženje volontera a u skladu s mogućnostima i edukacija i usavršavanje izvan udruge.”
<h6><i>Dominik Tomaš</i></h6>
</div>
Try to adjust the padding-left value to recenter it properly, since you're using border-left for the <blockquote> at the same time you had your text inside it, that's why it keeps the text sticking on the border, what i did is I tried to put the texts in a different element, but still in the inside the div. Check this if it helps you.
I want to create a maker for google maps which uses symbols from font-awesome. I would like that it looks somehow like this:
I found at Using Icon Fonts as Markers in Google Maps V3 a solution for this problem, however this requires to include a .js file which is ~0.5 MB large and thus not usable for me.
I also found this solution: https://github.com/lvoogdt/Leaflet.awesome-markers but I did not like the style of the markers.
I managed to create with css the following picture
<div style='display:inline-block;background-color:#08c;padding:10px;border-radius:20px;border:2px solid #FFF;color:#FFF;'>
<i class="fa fa-university" aria-hidden="true"></i>
</div>
But I don't know how to:
Get a nice white pointer at the bottom with CSS (as in the purple icon)
How to use this css marker in google maps. The best I can think of is to make a screenshot, make the black background transparent and save it as a png. But I guess there must be a more proper way to do it?
EDIT: I found in the comments from Using Icon Fonts as Markers in Google Maps V3
I don't think it's possible, one way of doing it would be to extract
the SVG properties from Font Awesome icons, and then define
google.maps.Symbol using SVG notation. Then you'd be able to use them
as symbols
I tried that and it failed. I am using the bank icon with unicode: f19c. So I opend fontawesome-webfont.svg and found an entry
<glyph unicode="" horiz-adv-x="2048" d="M960 1536l960 -384v-
128h-128q0 -26 -20.5 -45t-48.5 -19h-1526q-28 0 -48.5 19t-20.5
45h-128v128zM256 896h256v-768h128v768h256v-768h128v768h256v-768h128v768h256v-
768h59q28 0 48.5 -19t20.5 -45v-64h-1664v64q0 26 20.5 45t48.5 19h59v768zM1851
-64 q28 0 48.5 -19t20.5 -45v-128h-1920v128q0 26 20.5 45t48.5 19h1782z" />
Following the instructions to create marker symbols I tried
marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: {
path: 'M960 1536l960 -384v-128h-128q0 -26 -20.5 -45t-48.5
-19h-1526q-28 0 -48.5 19t-20.5 45h-128v128zM256 896h256v-768h128v768h256v-
768h128v768h256v-768h128v768h256v-768h59q28 0 48.5 -19t20.5 -45v-64h-
1664v64q0 26 20.5 45t48.5 19h59v768zM1851 -64 q28 0 48.5 -19t20.5 -45v-128h-
1920v128q0 26 20.5 45t48.5 19h1782z'
}
});
But I do not get a bank icon, only some strange lines:
Does anyone know why I don't get an icon here? And does this maybe lead to create a icon as wished above?
The path seems to be flipped vertically (you'll also need to scale it, the lines you see are just a part of a real large icon)
Fixed path:
M 0.19113133,-15.44788 16.905415,-8.7761997 v 2.223893 h -2.228571 q 0,0.4517349 -0.356919,0.7818476 -0.356919,0.3301132 -0.844418,0.3301132 h -26.568748 q -0.4875,0 -0.844421,-0.3301132 -0.35692,-0.3301127 -0.35692,-0.7818476 h -2.22857 v -2.223893 z M -12.066008,-4.3284126 h 4.4571411 V 9.0149371 h 2.228571 V -4.3284126 h 4.45714333 V 9.0149371 H 1.3054178 V -4.3284126 H 5.7625592 V 9.0149371 h 2.228573 V -4.3284126 H 12.448274 V 9.0149371 h 1.027233 q 0.487499,0 0.844418,0.3301126 0.356919,0.3301126 0.356919,0.7818463 v 1.111933 h -28.971426 v -1.111933 q 0,-0.4517337 0.35692,-0.7818463 0.356921,-0.3301126 0.844421,-0.3301126 h 1.027233 V -4.3284126 z M 15.704077,12.350789 q 0.4875,0 0.844418,0.330113 0.35692,0.330113 0.35692,0.781821 v 2.22392 h -33.428567 v -2.22392 q 0,-0.451708 0.356919,-0.781821 0.356919,-0.330113 0.844421,-0.330113 h 31.025889 z
function initialize() {
var mapOptions = {
zoom: 14,
center: new google.maps.LatLng(52.5498783, 13.425209099999961),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
marker = new google.maps.Marker({
position: mapOptions.center,
map: map,
icon: {
xscale:.2,
fillColor:'#000000',
fillOpacity:.5,
path: 'M 0.19113133,-15.44788 16.905415,-8.7761997 v 2.223893 h -2.228571 q 0,0.4517349 -0.356919,0.7818476 -0.356919,0.3301132 -0.844418,0.3301132 h -26.568748 q -0.4875,0 -0.844421,-0.3301132 -0.35692,-0.3301127 -0.35692,-0.7818476 h -2.22857 v -2.223893 z M -12.066008,-4.3284126 h 4.4571411 V 9.0149371 h 2.228571 V -4.3284126 h 4.45714333 V 9.0149371 H 1.3054178 V -4.3284126 H 5.7625592 V 9.0149371 h 2.228573 V -4.3284126 H 12.448274 V 9.0149371 h 1.027233 q 0.487499,0 0.844418,0.3301126 0.356919,0.3301126 0.356919,0.7818463 v 1.111933 h -28.971426 v -1.111933 q 0,-0.4517337 0.35692,-0.7818463 0.356921,-0.3301126 0.844421,-0.3301126 h 1.027233 V -4.3284126 z M 15.704077,12.350789 q 0.4875,0 0.844418,0.330113 0.35692,0.330113 0.35692,0.781821 v 2.22392 h -33.428567 v -2.22392 q 0,-0.451708 0.356919,-0.781821 0.356919,-0.330113 0.844421,-0.330113 h 31.025889 z'
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
html,body,#map_canvas{height:100%;margin:0;padding:0}
<div id="map_canvas"></div>
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
However, it will not be possible to achieve the desired result, because you would need multiple pathes(but only a single path is possible). You will need a custom overlay(e.g. https://github.com/googlemaps/js-rich-marker) to use fontawesome(the css-approach will not work with native markers, because they are based on either a complex <canvas/> or <img/>...where ::before/::after are not applicable)
You can use the :before and :after selector to implement that. Check below answer.
body {
background-color: grey;
}
.marker {
position: relative;
display: inline-block;
background-color: #08c;
padding: 10px;
border-radius: 50%;
border: 5px solid #FFF;
color: #FFF;
}
.marker:before {
content: "";
position: absolute;
bottom: -14.5px;
left: calc(50% - 16px);
border-style: solid;
border-width: 16px 16px 0;
border-color: #fff transparent;
display: block;
width: 0;
z-index: -1;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" />
<div class="marker">
<i class="fa fa-university" aria-hidden="true"></i>
</div>
I would like to get data from html
<div class="xyz">
<div class="opq">
<div class="one">One</div></div>
<div class="rst">
<div class="vwu">
<div class="alpha">A</div></div></div>
<div class="opq">
<div class="one">Two</div>
<div class="rst">
<div class="vwu">
<div class="alpha">B</div></div></div>
<div class="rst">
<div class="vwu">
<div class="alpha">C</div></div></div>
<div class="opq">
<div class="one">Three</div></div>
<div class="rst">
<div class="vwu">
<div class="alpha">D</div></div></div>
</div>
</div>
How i can get the data in new format, where A is child of One, Two is parents of B and C, and so D is parents of D. When i try use loop for ( element) i just get all of component. I have trouble to get element between One - Two - Three. There only one element (A) between "One" dan "Two". Next, 2 element (B & C) between "One" and "Two". The Last one is only 1 element, D, after "Three".
And i will show like :
One :
> A
Two :
> B
> C
Three :
> D
I use eq(0) to access them, but the result show false output.
To do that i'm simply doing this:
Elements ht = dok.select("div.one");
Elements li = dok.select("div.alpha:eq(0)");
for(Element el : ht ){
System.out.println(el.ownText()+" : "+li.get(i).text());
i++;
}
But the result was:
One :
> A
Two :
> B
Three :
> C
based on the result, isn't like what i hope. That's it between "Two" and "Three" actually have 2 element, B and C. While the last "Three" it must have element of D. But in this result , the element D is can't display.
Thanks for any advice
What's a difference in selector's pattern E * F and E F? Both E * F and E F applying appropriate style to F which is child of E. Consider HTML:
<div id= "parent">
<div id="subparent">
<div id="subsubparent">
<input type="text"/>
</div>
</div>
</div>
and corresponding css
#parent, #subparent{
padding:20px;
background:green;
width: 400px;
height: 400px;
}
#subparent{
background:black;
height:200px;
width:200px;
}
#subsubparent{
background: blue;
width:100px;
height:100px;
}
div[id="parent"] input{
width:50px;
}
Where div[id="parent"] input applying appropriate style to input which is child of div#parent. I my case div#subparent is child of div#parent, div#subsubparent is child of div#subparent and input is child of div#subsubparent. Hence input is child of div#parent.
In the case of E * F. E * matches any element which child of E and hence E * F mathces F element which child of E.
What's a difference in selector's pattern E * F and E F?
E F matches any F which is a descendant if E. The selector also matches if F is a child of E.
E * F matches any F which is a descendant of any descendant (*) of E. The selectors does not match if F is a child of E.
Example:
<div class="foo">
<div class="bar"></div>
<div class="baz">
<div class="bar"></div>
</div>
</div>
.foo .bar matches all .bar elements inside .foo.
.foo * .bar only matches the .bar element inside .baz.
Another way to look at it:
E F could also be written as E * F, E > F, hence E * F is only a subset of the what E F selects.
Selectors are explained here:
http://www.w3.org/TR/CSS21/selector.html
E F
means all F children of E.
E * F
means all F grand children of E. That is, F cannot be a direct child of E. That being said, it can be at any level below the children of E.
Another precision:
E > F
means F but only if a direct child of E.
E * F matches descendent F that is a descendent of * (anything), which is a descendent of E, while E F matches descendent F of E. E * F does not match it's child descendent, only descendents of its child. Use > for child.
In an app I am maintaining, I am implementing less (the styling language) changes for iPad form factors. I've already got media queries set up to handle this, but I have a slight problem with getting my markup to behave!
Currently, in our 'normal' form factor, we have a 3-column layout:
*---*-----*---*
| A | B | C |
*---*-----*---*
<div class="lft-side-panel">
A
</div>
<div class="ctr-panel">
B
</div>
<div class="rt-side-panel">
C
</div>
.lft-side-panel {
.span4(); // 4/16 slots wide
margin-left: 0;
left: 0;
}
.ctr-panel {
.span8();
}
.rt-panel {
.span4();
}
However, due to size constraints on these smaller form factors, I am trying for a 2-column setup as such:
*---*---------*
| A | |
*---* B |
| C | |
*---*---------*
<div class="lft-side-panel">
A
</div>
<div class="ctr-panel">
B
</div>
<div class="rt-side-panel">
C
</div>
/* These appear to be where the solution lies, at least as far as Less is concerned. */
.lft-side-panel,
.rt-side-panel {
left: 0;
margin-left: 0;
.span4();
}
.ctr-panel {
span12();
}
I've tried
specifying a top and left attribute with value 0 for the C div,
specifying float: left in the media query for the rt-side-pnl class
...but it leaves me with a layout like:
*---*-----*
| A | |
*---| B |
| |
*---*-----*
| C |
*---*
Question: What am I missing to achieve a 2-column layout with A and C on top of each other, and B off to the side? I have a feeling the solution is right under my nose, but I'm just not seeing it. If possible, I must preserve the structure of the markup; if I must re-order things slightly, that can work too.
Check out this fiddle http://jsfiddle.net/s756e/3/
I set .rt-side-panel, .lft-side-panel { float:left; width=25%;} (needed to convert your 4 of 16 bootstrap to percent and added some demo colors and heights) and set .ctr-panel {float:right; width=75%;}
This seems to be, what you are looking for. Right!?