Horizontal scrolling content with non-scrolling sidebar - html
I'm trying to create a horizontal scrolling area with a sidebar, that is not scrollable. I want to create it without using position: fixed; but I can't make it work. What am I missing?
HTML
<div class="sidebar">
<h1 class="logo">Title</h1>
</div>
<div class="scroll-area">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Animi harum, magnam, ducimus corporis ipsam blanditiis possimus
voluptate obcaecati laboriosam dicta quidem perspiciatis ipsa
tenetur. Asperiores veritatis dicta doloremque. Ea, ad.
</p>
<div class="image-gallery">
<ul>
<li><img src="http://placehold.it/500x800"></li>
<li><img src="http://placehold.it/500x800"></li>
<li><img src="http://placehold.it/500x800"></li>
</ul>
</div>
</div>
CSS
.scroll-area {
width: 3000px;
overflow: scroll;
}
ul li {
display: inline;
}
EDIT
I've created a fiddle to visualize my issue. As it is now, the sidebar is scrolling together with the content.
Here is an example that achieves what I believe you're trying to do. Replace code as needed.
HTML:
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch Report</button>
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel"> Annuities Report</h4>
</div>
<pre class="report-pre modal-body report-modal-body">
INDIVIDUAL ANNUITIES
BY AGENCY WITH AGENT DETAIL
COMMISSIONABLE DEPOSITS
MONTH TO DATE
AGENCY NUMBER
AGENCY NAME FLEXIBLE ANNUITY SPIA SPDA VARIABLE ANNUITY TOTAL
AGENT #
AGENT NAME COUNT 1ST YEAR EXTERNAL INTERNAL SUBSEQUENT TOTAL COUNT 1ST YEAR EXTERNAL INTERNAL TOTAL COUNT 1ST YEAR EXTERNAL INTERNAL TOTAL COUNT 1ST YEAR EXTERNAL INTERNAL SUBSEQUENT TOTAL COUNT 1ST YEAR EXTERNAL INTERNAL SUBSEQUENT TOTAL
----------------------------------------------------------------- ------------------------------------------------------ ------------------------------------------------------ ----------------------------------------------------------------- ----------------------------------------------------------------
EN00000006
POE - James
AG00000001
POE, Henry 1.00 2,512 25,812 0 450 28,775 .00 0 0 0 0 .00 0 0 0 0 .00 0 0 0 1,741 1,741 1.00 2,512 25,812 0 2,191 30,516
AG00050001
Eve, .00 0 0 0 0 0 .00 0 0 0 0 .00 0 0 0 0 .00 52 0 0 3,081 3,133 .00 52 0 0 3,081 3,133
AG000400
Bob, .00 30 0 0 100 130 .00 0 0 0 0 .00 0 0 0 0 .00 166 0 0 370 536 .00 196 0 0 470 666
1.00 2,542 25,812 0 550 28,905 .00 0 0 0 0 .00 0 0 0 0 .00 218 0 0 5,192 5,410 1.00 2,760 25,812 0 5,742 34,315
EN00000010
LOST AGENT
AG00005
Jim, RI .00 0 0 0 0 0 .00 0 0 0 0 .00 0 0 0 0 .00 0 0 0 100 100 .00 0 0 0 100 100
.00 0 0 0 0 0 .00 0 0 0 0 .00 0 0 0 0 .00 0 0 0 100 100 .00 0 0 0 100 100
</pre>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-dialog -->
</div>
CSS:
.report-modal-body {
max-height:calc(100vh - 150px);
overflow-y:auto;
overflow-x:auto;
}
.report-pre {
width:100%;
overflow-x:auto;
word-wrap:normal;
margin:1px;
}
Fiddle
Try This
white-space:nowrap;
Full code:
.scroll-area {
width: 85%;
float: left;
overflow: scroll;
white-space: nowrap;
}
.sidebar {
width: 15%;
float: left;
}
I hope this will help you.
Here is Fiddle
Related
How do I center the dots (SVG) with the class .stroke1
This is the needed code .strokes { display: flex; width: 100%; } .stroke1 { position: absolute; z-index: 1002; justify-content: center; text-align: center; align-items: center; } <section class="home" id="home"> <div class="max-width"> <div class="star star1"></div> <div class="home-content"> <div class="text-1">Hello, my name is</div> <div class="text-2">Hadi Zouhbi</div> <div class="text-3">And I'm a <span class="txt-rotate" data-period="2000" data-rotate='[ "Developer.", "UX Designer.", " Programmer.", "Full-Stack Dev.", "Marketer" ]' id="headSpan"></span></div> Hire Me </div> </div> </section> </header> <div class="strokes"> <svg class="stroke1" stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="3em" width="3em" xmlns="http://www.w3.org/2000/svg"><path d="M456 231a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 280a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 280a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"></path></svg> </div> I want the stroke to be in the middle of the page but nothing is working , it always stays on the left side , am I doing anything wrong ?
If all you're trying to do is center the <svg> then there were a couple issues with your code. First, justify-content and align-items need to be set on the flex container itself (i.e. the same element that has the display: flex rule applied to it), not its children. Second, anything that is absolutely positioned will override any inherent flex positioning applied to it, so I don't think you want that in this case. Here's an updated code snippet that addresses the above points and thus centers the dots. .strokes { display: flex; justify-content: center; text-align: center; align-items: center; width: 100%; } .stroke1 { z-index: 1002; } <section class="home" id="home"> <div class="max-width"> <div class="star star1"></div> <div class="home-content"> <div class="text-1">Hello, my name is</div> <div class="text-2">Hadi Zouhbi</div> <div class="text-3">And I'm a <span class="txt-rotate" data-period="2000" data-rotate='[ "Developer.", "UX Designer.", " Programmer.", "Full-Stack Dev.", "Marketer" ]' id="headSpan"></span></div> Hire Me </div> </div> </section> </header> <div class="strokes"> <svg class="stroke1" stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024" height="3em" width="3em" xmlns="http://www.w3.org/2000/svg"><path d="M456 231a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 280a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 280a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"></path></svg> </div>
svg img only loads after text tag(h1/h2/h3/p)?
Context I'm trying to create a standard navbar using tailwind css framework. Blocker Whenever I try to load the svg logo without a h/p tag, in the example below - "Temp", it doesn't load. body { background-image: url('https://image.tmdb.org/t/p/original/rAiYTfKGqDCRIIqo664sY9XZIvQ.jpg'); background-size: cover; } a { text-decoration: none; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>MovieApp</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"> <link rel="stylesheet" href="../static/css/css.css"> <link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet"> </head> <body> <header class="mx-96 flex items-center justify-between"> <div> <h1>temp</h1> <a href="#"> <img src="../static/img/tmdb.svg" alt=""> </a> </div> <div> <h1>Temporary text</h1> </div> </header> </body> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> </html> SVG: <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 407.34 160.81"><defs><style>.cls-1{fill:#01d277}</style></defs><title>PoweredByRectangle_Green</title><path class="cls-1" d="M50.38 102.47h6.94V74.71h8.64v-6.89H41.74v6.89h8.64v27.76zM88.53 102.47h6.94v-34.7h-6.94v13.88H78.14V67.77H71.2v34.7h6.94V88.59h10.39v13.88zM121.25 95.53h-13.02v-6.94h11.12v-6.94h-11.12v-6.94h12.43v-6.94h-19.38v34.7h19.97v-6.94zM157.79 82.54L144.1 67.3h-2.23v35.24h7.03V83.17l8.89 9.32 8.88-9.32-.05 19.37h7.04V67.3h-2.19l-13.68 15.24z"/><path class="cls-1" d="M3309.1 1841.93c-23.88 0-23.88 35.77 0 35.77s23.9-35.77 0-35.77zm0 28.59c-13.88 0-13.88-21.45 0-21.45s13.9 21.45 0 21.45z" transform="translate(-3111.93 -1774.68)"/><path class="cls-1" d="M254.5 67.83h6.94v34.7h-6.94zM274.19 95.6v-6.94h11.13v-6.94h-11.13v-6.94h12.44v-6.95h-19.38v34.71h19.96V95.6h-13.02z"/><path class="cls-1" d="M3429.48 1842.91h-10.34v34.7h10.34c23.1 0 23.1-34.7 0-34.7zm0 27.76h-3.4v-20.82h3.4c13.52 0 13.52 20.82 0 20.82z" transform="translate(-3111.93 -1774.68)"/><path class="cls-1" d="M3472.7 1860.23c2.18-1.5 3.11-4.22 3.2-6.84.15-6.12-3.69-10.53-9.85-10.53h-13.74v34.75H3466a10.32 10.32 0 0 0 10.24-10.44 8.43 8.43 0 0 0-3.54-6.94zm-13.4-10.44h6.17a3.51 3.51 0 0 1 0 7h-6.17v-7zm6.17 20.87h-6.17v-6.94h6.17a3.41 3.41 0 0 1 3.49 3.45 3.45 3.45 0 0 1-3.49 3.5z" transform="translate(-3111.93 -1774.68)"/><path class="cls-1" d="M233.13 86.57L224 67.83h-8.01l16.37 35.44h1.55l16.37-35.44h-8.01l-9.14 18.74z"/><path class="cls-1" d="M3494.78 1920.93c14.6 0 24.48-9.88 24.48-24.48v-97.28c0-14.6-9.88-24.48-24.48-24.48h-358.37c-14.6 0-24.48 9.88-24.48 24.48v136.33l12.56-14.56v-121.77a11.94 11.94 0 0 1 11.92-11.92h358.37a11.94 11.94 0 0 1 11.92 11.92v97.28a11.94 11.94 0 0 1-11.92 11.92H3155l-12.56 12.56-.08-.1z" transform="translate(-3111.93 -1774.68)"/><path class="cls-1" d="M3154.3 1827.53v-15h5.9c5.84 0 5.82 9.26 0 9.26h-2.9v5.73h-3zm5.65-8.65c2 0 2-3.36 0-3.36h-2.65v3.36h2.65zM3176.07 1812.27c10.33 0 10.33 15.47 0 15.47s-10.33-15.47 0-15.47zm0 3.09c-6 0-6 9.28 0 9.28s6.01-9.29 0-9.29zM3193.12 1827.85l-6.15-15.33h3.38l3 7.66 2.94-7.52h.15l2.94 7.52 3-7.66h3.38l-6.13 15.26h-.55l-2.75-6.66-2.73 6.72h-.52zM3209.53 1827.53v-15h7.47v3h-4.51v3h3.95v3h-3.95v3h4.77v3h-7.77zM3229.47 1827.53l-3-5.73H3225v5.73h-3v-15h5.92c5.35 0 5.88 7.54 1.47 8.82l3.49 6.19h-3.4zm-4.47-8.65h2.65c2 0 2-3.36 0-3.36H3225v3.36zM3236.76 1827.53v-15h7.52v3h-4.51v3h3.95v3h-3.95v3h4.77v3h-7.77zM3253.71 1827.53h-4.47v-15h4.47c9.99-.01 9.99 15 0 15zm-1.47-12v9h1.47c5.84 0 5.84-9 0-9h-1.47zM3291.89 1820.77l-5.23-8.25h3.65l3.07 5.17 3.07-5.17h3.67l-5.25 8.25v6.76h-3v-6.76zM3282.58 1820.18a3.68 3.68 0 0 0 1.39-3 4.13 4.13 0 0 0-4.26-4.56h-5.94v15h5.94a4.46 4.46 0 0 0 4.43-4.51 3.65 3.65 0 0 0-1.56-2.93zm-5.79-4.51h2.67a1.52 1.52 0 0 1 0 3h-2.67v-3zm2.67 9h-2.67v-3h2.67a1.47 1.47 0 0 1 1.51 1.49 1.49 1.49 0 0 1-1.52 1.54z" transform="translate(-3111.93 -1774.68)"/></svg>
The problem with this is that you have to consider setting a with and height to the image so that it gets a real displaying space if it is not a child of any other tag like hs or p.
Bootstrap align svg in center of header
I copied this card template from bootstrap for a warning card. At the header of the card, I'm using an svg that I got from Bootstrap's icons https://icons.getbootstrap.com/icons/exclamation-triangle-fill/. There, you can see some examples where the icon is implemented properly. The icon is aligned exactly in the middle next to the next. However, in my code the icon is aligned at the bottom and so is not centered. Is there a way to fix this? <div class="card" style="width: 18rem;"> <div class="card-body"> <div class="mb-3"> <h5 class="card-title"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 5zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/> </svg> Warning </h5> </div> <p class="card-text"> Text of card </p> </div> </div>
Use negative margin-top to adjust it. For example: <div class="card" style="width: 18rem;"> <div class="card-body"> <div class="mb-3"> <h5 class="card-title"> <svg class="myIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 5zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/> </svg> Warning </h5> </div> <p class="card-text"> Text of card </p> </div> </div> CSS: .myIcon { margin-top: -5px; } Check it here: https://jsfiddle.net/8t61qehn/
printf("%d\n", 42); /* You can simply add some css on style part in as follows: */ .card-svg { position: absolute; left: 50%; transform: translate(-50%, -50%); } .card-txt{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; } /*And add this styles as classes on your HTML code as follows: */ <img class="card-svg" src="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 5zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/> <img> <h5 class="card-txt">Warning</h5> /By the way i changed the svg into img you can try like that if this is what you want./
My Result Just change first DIV style with text-align: center Check the image from above make sure that way you want show drop like if work for you.
Reduce height and width of 3 bars inside Font Awsome Hamburger
I want to make slim to 3 bars inside Hamburger. These 3 bars look fat when I apply "fa-2x". Using code <i class="fa fa-bars"></i>
You can suscribe to pro licence to have acces to icon light style or you can use a custom svg. Solid (free): Light (pro): Custom thin icon menu example var faSplat = { prefix: 'fac', iconName: 'bars', icon: [ 448, 448, [], null, 'M442 114H5a5 5 0 0 1-5-5V84a5 5 0 0 1 5-5h435a5 5 0 0 1 5 5v24a5 5 0 0 1-5 5zm0 160H5a5 5 0 0 1-5-5v-24a5 5 0 0 1 5-6h435a5 5 0 0 1 5 5v24a5 5 0 0 1-5 5zm0 160H5a5 5 0 0 1-5-5v-24a5 5 0 0 1 5-5h435a5 5 0 0 1 5 5v24a5 5 0 0 1-5 5z' ] } FontAwesome.library.add(faSplat) <script src="https://use.fontawesome.com/releases/v5.0.9/js/all.js"></script> <i class="fac fa-bars fa-2x"></i> <br/> <br/> <div style="background-color : black; padding: 10px"> <i class="fac fa-bars fa-2x fa-inverse"></i> </div> More information about custom icons in fontawesome : https://github.com/mlwilkerson/fa-custom-icon-demo
SVG logo doesn't look good in Bootstrap navbar
Designer has sent me a new logo as a SVG. I want to use it inline in my HTML but I could not get it to display without setting min-width. However now I am using min-width to get logo to desired size, the bottom of the logo is lower than the bottom of the navbar. How do I get the SVG to use more space above the logo, and less space under, so that the logo is neatly positioned within the navbar and looks good? Code .navbar-brand { min-width: 250px; } <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/"> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!-- Creator: CorelDRAW X6 --> <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 7090 1628" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"> <![CDATA[ .fil1 {fill:#FEFEFE} .fil3 {fill:#FEFEFE;fill-rule:nonzero} .fil2 {fill:#033C73;fill-rule:nonzero} .fil0 {fill:url(#id0)} ]]> </style> <linearGradient id="id0" gradientUnits="userSpaceOnUse" x1="800.768" y1="1267.59" x2="932.867" y2="1645.01"> <stop offset="0" style="stop-color:#C5C6C6"/> <stop offset="0.639216" style="stop-color:#FDFDFD"/> <stop offset="1" style="stop-color:#FEFEFE"/> </linearGradient> </defs> <g id="Layer_x0020_1"> <metadata id="CorelCorpID_0Corel-Layer"/> <polygon class="fil0" points="1098,1285 1098,1628 636,1325 "/> <path class="fil1" d="M1184 96c274,194 275,949 37,1156 -189,164 -846,166 -1038,8 -246,-203 -245,-950 10,-1150 181,-142 805,-146 991,-14z"/> <path class="fil2" d="M1132 694c2,1 4,3 5,5 57,56 91,134 91,219l0 97 -177 0 0 -97c0,-37 -15,-70 -39,-94 -24,-24 -57,-39 -93,-39l0 -1 -131 0 0 142 0 88 -89 0 -222 0 0 1c-85,0 -163,-35 -219,-92 -57,-56 -92,-134 -92,-219l0 -314 178 0 0 314c0,36 15,69 39,94 24,24 58,39 94,39l0 0 134 0 0 -447 177 0 0 213 131 0 0 -1c36,0 69,-15 93,-39 24,-24 39,-57 39,-94l0 -79 177 0 0 79c0,85 -34,163 -91,219 -1,2 -3,4 -5,6z"/> <path class="fil3" d="M1990 870c-90,0 -152,-67 -152,-158 0,-92 62,-159 152,-159 72,0 121,43 136,112l140 0c-17,-142 -125,-239 -275,-239 -166,0 -291,120 -291,286 0,165 125,285 291,285 150,0 258,-97 275,-239l-140 0c-15,69 -64,112 -136,112zm843 -433l-136 0 0 220 -224 0 0 -220 -136 0 0 549 136 0 0 -206 224 0 0 206 136 0 0 -549zm459 455l37 94 145 0 -233 -552 -130 0 -233 552 145 0 37 -94 232 0zm-45 -117l-142 0 71 -182 71 182zm640 -216l0 -122 -486 0 0 122 175 0 0 427 137 0 0 -427 174 0zm483 268l118 159 164 0 -141 -186c66,-33 105,-93 105,-170 0,-119 -91,-193 -227,-193l-240 0 0 549 136 0 0 -159 85 0zm-85 -123l0 -147 101 0c53,0 95,29 95,73 0,45 -42,74 -95,74l-101 0zm668 -278c-165,0 -291,126 -291,286 0,159 126,285 291,285 166,0 291,-126 291,-285 0,-160 -125,-286 -291,-286zm0 445c-89,0 -153,-73 -153,-159 0,-87 64,-159 153,-159 89,0 152,72 152,159 0,86 -63,159 -152,159zm639 -445c-165,0 -290,126 -290,286 0,159 125,285 290,285 167,0 292,-126 292,-285 0,-160 -125,-286 -292,-286zm0 445c-88,0 -152,-73 -152,-159 0,-87 64,-159 152,-159 89,0 153,72 153,159 0,86 -64,159 -153,159zm955 -434l-102 0 -194 293 -196 -293 -101 0 0 549 137 0 -1 -277 123 190 0 1 75 0 0 -1 122 -188 0 275 137 0 0 -549zm307 -12c-129,0 -218,69 -218,179 0,87 51,138 159,162l91 20c47,9 58,28 58,47 0,29 -27,48 -78,48 -64,0 -106,-29 -115,-77l-136 0c13,135 124,193 247,193 138,0 228,-68 228,-178 0,-95 -65,-135 -165,-157l-77 -17c-41,-9 -63,-22 -63,-52 0,-36 31,-55 78,-55 56,0 82,28 89,69l137 0c-14,-147 -146,-182 -235,-182z"/> </g> </svg> </a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="active">Home</li> </ul> </div> </div> </nav>
.navbar-brand { width: 35vw; } use VW ( viewport width) it is used to resize the image based on window size
Do not use the svg code. I hope the designer has provided you a file with the extension .svg. Use that file as source of image. <img class="logo" src="your-path/logo.svg" /> Then add you desired width using css. .logo { width: 150px; }