I've searched through this site and it seems that the best way to resize components dynamically is though CSS "position" and "width/height" parameters.
I have an app which partially looks like so:
It is currently being resized through Javascript ($(window).width(), $(window).height()), and I would like to do it properly though CSS.
Here is my table layout:
<table class="table">
<tr >
<td >
<div id="chartdiv1" ></div>
</td>
<td rowspan="3">
<div id="Simulation" ></div>
<div id="SimLabels" style="border: dashed; z-index: 1; width: 190px; position: relative; ">
<input type="checkbox" onchange="redrawSim()" checked="checked" id="BedMassLabel"><strong style="color: #4bb2c5;">Bed Mass (kg)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="H2OBedLabel"><strong style="color: #EAA228;">H2O in Fluid Bed (kg)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="BedTempLabel"><strong style="color: #c5b47f;">Temperature of Bed (C)</strong><br />
<input type="checkbox" onchange="redrawSim()" checked="checked" id="evapRateLabel"><strong style="color: #579575;">Evaporation Rate (?)</strong>
</div>
</td>
</tr>
<tr >
<td>
<div id="chartdiv2" ></div>
</td>
</tr>
<tr >
<td >
<div id="chartdiv3" ></div>
</td>
</tr>
</table>
I have tried many combinations of positions, widths and heights, but very often it seems that no matter what percentage I put down for the width/height, the layout has a mind of its own.
It should be mentioned that I am using both MVC and Twitter Bootstrap, so perhaps my html is affected by this. Could someone help me fix my html so that it replicates the design above with dynamic sizing?
It is better to use <div> elements rather than a table for layout purposes. Check this SO Post for the reasons behind this.
Since you are using Twitter Bootstrap, your best option is using the Bootstrap's excellent (and core feature) grid system.
Here is a quick setup using Bootstrap 2.3:
<div class="row">
<div class="span3">
<div class="row">
<div class="span12">
<div id="chartdiv1" ></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="chartdiv2" ></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="chartdiv3" ></div>
</div>
</div>
</div>
<div class="span9">
<div id="Simulation" ></div>
</div>
</div>
or using Bootstrap 3 RC1:
<div class="row">
<div class="col-lg-3">
<div class="row">
<div class="col-lg-12">
<div id="chartdiv1" ></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="chartdiv2" ></div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div id="chartdiv3" ></div>
</div>
</div>
</div>
<div class="col-lg-9">
<div id="Simulation" ></div>
</div>
</div>
Related
I am trying to horizontally center some text with the search bar using Bulma CSS, but it didn't work out the way I wanted. I tried using columns, but they are usually pulled all the way over at the edge or not placed properly. I also tried using levels but they also had similar results that I didn't want. Please help.
Here is my code:
<div class="container section">
**<p> I want to make this tag to be in the same line as the search box </p>**
<div class="field has-addons is-pulled-right">
<div class="control">
<input class="input" type="text" placeholder="Search competition">
</div>
<div class="control">
<a class="button is-info">
Search
</a>
</div>
</div>
</div>
I want to have some text aligned to the left of the container and the search box located on the opposite right side of the row. Thank you.
Can you describe what issues you were having with the columns? Did you try using the .is-vcentered class on the .columns div?
Make sure to view the following code in a full screen.
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css" rel="stylesheet"/>
<div class="container section">
<div class="columns is-vcentered">
<div class="column">
<p style="border: 1px solid #ccc;"> I want to make this tag to be in the same line as the search box </p>
</div>
<div class="column">
<div class="field has-addons is-pulled-right">
<div class="control">
<input class="input" type="text" placeholder="Search competition">
</div>
<div class="control">
<a class="button is-info">
Search
</a>
</div>
</div>
</div>
</div>
</div>
OR I see that you said horizontally centered. Did you try the .is-centered class on the .columns container and the .is-narrow class on the .columns?
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css" rel="stylesheet"/>
<div class="container section">
<div class="columns is-centered is-vcentered">
<div class="column is-narrow">
<p style="border: 1px solid #ccc;"> I want to make this tag to be in the same line as the search box </p>
</div>
<div class="column is-narrow">
<div class="field has-addons">
<div class="control">
<input class="input" type="text" placeholder="Search competition">
</div>
<div class="control">
<a class="button is-info">
Search
</a>
</div>
</div>
</div>
</div>
</div>
I am trying to implement a single page application where I want divs to display one below the other. But on resizing the viewport to various screen sizes, the positioning is getting overlapped and leaving extra spaces in between. I have codepen example to explain the problem in a better way.
https://codepen.io/SaloniDesai/pen/zPBZJr
How to make the divs appear same for every screen size ?Do i need to shuffle the way I have created the layout of the page ?
<div id="headliner" class="jumbotron text-center">
<h1>SearchGIFY app</h1>
<p>search for any GIF you want!</p>
</div>
<div id="search">
<form>
<input type="search" ng-model="vm.search.gif" value="" placeholder="type what you're looking for" />
<button type="submit" class="btn btn-primary" ng-click="vm.performSearch()">Search</button>
</form>
</div>
<div class="row">
<div class="card">
<img ng-repeat="g in vm.giphies" ng-src="{{g.images.original.url}}" height="{{g.images.fixed_height}}" title="{{g.title}}">
</div>
</div>
<div class="jumbotron text-center" id="trendingBar">
<h3>Trending gifs</h3>
<div class="row">
<div class="thumbnail">
<img ng-repeat="trending in vm.trendingGifs" ng-src="{{trending.images.original.url}}" height="{{trending.images.fixed_height.height}}" title="{{trending.title}}">
</div>
</div>
</div>
First, your bootstrap structure isn't good, there isn't container, neither rows or col.
Try this one:
<div class="container-fluid">
<div class="row">
<div id="headliner col-md-12" class="jumbotron text-center">
<h1>SearchGIFY app</h1>
<p>search for any GIF you want!</p>
</div>
</div>
<div class="row">
<div id="search">
<div class="col-md-12">
<form class="form-inline text-center col-md-6 col-md-offset-3">
<div class="form-group">
<input class="form-control" type="search" ng-model="vm.search.gif" value=""
placeholder="type what you're looking for"/>
</div>
<button type="submit" class="btn btn-primary" ng-click="vm.performSearch()">Search</button>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<img ng-repeat="g in vm.giphies" ng-src="{{g.images.original.url}}" height="{{g.images.fixed_height}}"
title="{{g.title}}">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="jumbotron text-center" id="trendingBar">
<h3>Trending gifs</h3>
<div class="thumbnail">
<img ng-repeat="trending in vm.trendingGifs" ng-src="{{trending.images.original.url}}"
height="{{trending.images.fixed_height.height}}" title="{{trending.title}}">
</div>
</div>
</div>
</div>
Second, you add a lot of absolute class with % height and width. You don't have to do that if you're using bootstrap, all the responsive stuff is handled by the bootstrap grid with col classes. Take a quick look at the grid bootstrap documentation : https://getbootstrap.com/docs/3.3/css/#grid
Here's the codepen working responsively with some modification : https://codepen.io/anon/pen/MOemgw ;)
I'm having issues with input boxes overlapping each other as the screen starts shrinking down in width. Is there way to fix this in bootstrap 2 files or directly adjusting the css inline?
Here is the main page that holds the content.
<div class="content-center">
<div class="container">
<div class="row-fluid">
<div class="span9">
<div class="content-area">
//WHERE CONTENT IS LIVING
</div>
</div>
<div class="span3">
<div class="sidebar">
<div class="content-area">
</div>
</div>
</div>
</div>
</div>
</div>
Here is the actual code where the content is at.
<div class="well">
<div class="row-fluid">
<div class="span4">
<h4>Dinner Banquet w Cocktail Reception Total:</h4>
<div class="input-prepend">
<span class="add-on" style="font-size:24px;">$</span><INPUT NAME="xbrunchdinneronlytotal" TYPE="text" style="font-weight:bold; font-size:18px; color:#2e713b; background-color:#ffffff;" onKeyUp="javascript:getbrunchdinnertotal(this);" value="0" >
</div>
</div>
<div class="span4">
<h4>Wine Tour:</h4>
<div class="input-prepend">
<span class="add-on" style="font-size:18px;">Qty</span>
<input type="text" name="xwinetouronly" onKeyUp="javascript:getwinetouronlytotal(this);" placeholder="Enter Quantity">
</div>
<h4>Total:</h4>
<div class="input-prepend">
<span class="add-on" style="font-size:24px;">$</span>
<INPUT NAME="xwinetouronlytotal" TYPE="text" style="font-weight:bold; font-size:18px; color:#2e713b; background-color:#ffffff;" onKeyUp="javascript:getwinetouronlytotal(this);" value="0"></div>
</div>
<div class="span4">
<h4>Exhibit Fee:</h4>
<div class="input-prepend">
<span class="add-on" style="font-size:24px;">$</span>
<INPUT NAME="xhibittotal" TYPE="text" style="font-weight:bold; font-size:18px; color:#2e713b; background-color:#ffffff;" onKeyUp="javascript:getgolftotal(this);" value="0" >
</div>
</div>
</div>
</div>
Here is the browser width at 1199px
And here is the browser width at 979px
So is there any way to fix this. I know I can mess with the media query in my own custom css but im also wondering if I can fix this in the bootstrap 2 source files. Or Just fix this directly with inline CSS
Put all your inputs into columns
<div col-lg-4 col-lg-4 col-sm-12 col-sm-12>
Dinner Banuqet
//input field
</div>
<div col-lg-4 col-lg-4 col-sm-12 col-sm-12>
Wine Tour
//input field
</div>
<div col-lg-4 col-lg-4 col-sm-12 col-sm-12>
Exhibit Fee
//input field
</div>
on a large and meduim screen there will be 3 columns with the content taking up the whole screen. On small and extra small screens the content will be vertically aligned. You can add the cols directly into your input-append class
I need to make image positioned like on below picture:
I have code:
<footer>
<div class="stopka1">
<div class="container">
....................
</p>
</div>
</div>
</footer>
<div class="container">
<div class="row" style="padding-right:0; padding-left:0;padding-top:30px;padding-bottom:20px;">
<div class="col-md-6">
<div class="row">
<div class="col-xs-6"><img src="phone.png" style="vertical-align:middle !important;"> <span style="font-weight:lighter;color:rgb(10, 55, 110);font-size: 28px; vertical-align:middle !important;">22 213 18 31</span></div>
<div class="col-xs-6"><button class="col-cs-12 przycisk-pytanie" style="font-weight: bold;margin-top:0;">Zadaj pytanie</button></div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-xs-2"><img src="women.png" style=""></div>
<div class="col-xs-5">.. price ..</div>
<div class="col-xs-5"><button class="przycisk-rezerwuj-big" style="font-weight: bold;height:35px;">Rezerwuj teraz</button></div>
</div>
</div>
</div>
</div>
Have someone any idea how to get this effect? I have no idea how to force it to cover higher div.
You can do one of two options:
OPTION 1
img {margin-top:-20px;}
OPTION 2
img {position:relative; top:-20px;}
I'm trying to display a nested Wicket ListView structure as an html table like <div> structure. This is because I want parts of this table to change it's visibility at runtime and therefore want to add WebMarkContainers and then operate on them.
Since this is most-likeley an html problem, I start by only posting the html.
<form wicket:id="matrixForm">
<div class="table">
<div class="table-header-group">
<div class="table-row">
<div class=table-cell></div>
<div class=table-cell></div>
<div wicket:id="columnsList" class="table-cell">
<div wicket:id="zustLabel"></div>
</div>
</div>
</div>
<div class="table-row-group">
<div wicket:id="groupsList" class="table-row">
<div wicket:id="groupLabel" class="table-cell"></div>
<div wicket:id="rowsList">
<div wicket:id="erhebungLabel" class="table-cell"></div>
<div wicket:id="cellList" class="table-cell">
<div wicket:id="cell">
<input wicket:id="checkbox" type="checkbox">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
Basically I don't wont to have this <div wicket:id="rowsList">, but I need an element to map my ListView on.
The generated structure is:
<div class="table">
<div class="table-header-group">
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell">
<div>zustLabel</div>
</div>
<div class="table-cell">
<div>zustLabel</div>
</div>
<div class="table-cell">
<div>zustLabel</div>
</div>
</div>
</div>
<div class="table-row-group">
<div class="table-row">
<div class="table-cell">groupLabel</div>
<div ><!-- This is the rowsList div -->
<div class="table-cell">erhebungLabel</div>
<div class="table-cell">
<div class="checked" id="cell15">
<input type="checkbox" checked="checked">
</div>
</div>
<div class="table-cell">
<div class="unchecked" id="cell18">
<input type="checkbox">
</div>
</div>
<div class="table-cell">
<div class="unchecked" id="cell17">
<input type="checkbox">
</div>
</div>
</div>
</div>
</div>
I marked the <div> which I don't want to have with a comment. Is it even possible to generate the same structure in the table-row-group as it is in the table-header-group?
Each element titled with "xxxList" stands for a ListView, so:
columnsList to display the tables header
groupsList to wrap the rows which belong together
rowsList to display the subcategories of the groups
cellList to fill the free fields with check boxes
It's more like an authorization matrix than a data table. I gave the classes the appropriate display:[table element] property to make them behave like a table.
Fiddle Demo
You can use
<wicket:container wicket:id="rowsList"></wicket:container>
instead of a <div>