I have a table like this and i want this;
tr {
float: left !important;
}
tr:nth-child(2n+1) {
clear: left !important;
padding-right: 10px !important;
}
<table>
<tbody>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
<tr><td>5</td></tr>
<tr><td>6</td></tr>
<tr><td>7</td></tr>
<tr><td>8</td></tr>
<tr><td>9</td></tr>
</tbody>
</table>
This code not working internet explorer 7, how can i solve? This is explorer 7 result;
try this
table, tbody, tr {
display: block;
}
tr {
float: left;
width: 50%;
}
I suggest trying to use DIV instead of a table. It may help you to achieve the desired output for the IE 7 browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">
#container, #left, #right{margin: 0px; padding: 0px; border: 0px;}
#left{width: 10%; float: left;}
#right{width: 90%; float: right;}
</style>
</head>
<body>
<div id="container">
<div id="left">
1
</div>
<div id="right">
2
</div>
<div id="left">
3
</div>
<div id="right">
4
</div>
</div>
<div id="left">
5
</div>
<div id="right">
6
</div>
</div>
<div id="left">
7
</div>
<div id="right">
8
</div>
<div id="right">
9
</div>
</div>
</body>
</html>
Output in the IE 11 browser with Document mode IE 7:
Related
How can I get a Bootstrap 5 grid row to span its entire content vertically? In the example below, if I add a label element the content of the first row flows over the second row.
<!doctype html>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
.ql-container {
box-sizing: border-box;
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
height: 100%;
margin: 0px;
position: relative;
}
.ql-snow {
box-sizing: border-box;
border: 1px solid #d1d5db;
}
.ql-editor {
box-sizing: border-box;
line-height: 1.42;
height: 100%;
outline: none;
overflow-y: auto;
padding: 12px 15px;
-o-tab-size: 4;
tab-size: 4;
-moz-tab-size: 4;
text-align: left;
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body>
<div class="container">
<form class="my-3">
<div class="row py-2">
<div class="col-md-12">
<label for="txtBox" class="form-label">Title</label>
<div id="txtBox" class="ql-container ql-snow">
<div class="ql-editor">
<p>TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE</p>
</div>
</div>
</div>
</div>
<div class="row py-2">
<div class="col-md-12">
next row
</div>
</div>
</form>
</div>
</body>
</html>
Edit 1:
Smaller example
<!doctype html>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
.ql-container {
height: 100%;
position: relative;
border: 1px solid #d1d5db;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
Title
<div id="txtBox" class="ql-container">
<p>
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
TESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTESTESTTESTE
</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
next row
</div>
</div>
</div>
</body>
</html>
This overlap is being caused by your style rule:
<style>
.ql-container {
height: 100%;
...
}
</style>
Along with the html structure:
<div class="col"><!-- this is the parent element -->
Title <!-- the height of this text is same as overlap -->
<div id="txtBox" class="ql-container">
<!-- because this element's height is 100% of the parent -->
</div>
</div>
If you must have the style rule, for reasons not made apparent in your question, then the solution is to
Either: Make a whole new .row with .col for the text Title:
<div class="row">
<div class="col">
Title <!-- the height of this text no longer has affect -->
</div>
</div>
<div class="row">
<div class="col"><!-- this is the parent element -->
<div id="txtBox" class="ql-container">
<!-- this element's height is 100% of the parent -->
</div>
</div>
</div>
Or: Just put Title in its own .col-12 forcing subsequent .col(s) to wrap to the next line.
<div class="row">
<div class="col-12">
Title <!-- the height of this text no longer has affect -->
</div>
<div class="col"><!-- this is the parent element -->
<div id="txtBox" class="ql-container">
<!-- this element's height is 100% of the parent -->
</div>
</div>
</div>
i want to make my horizontal table go vertical in responsive. what i mean is that my table is at the moment horizontal, and i want to make it vertical. i dont care if it is with table attributes or div attributes.
thanks.
i dont know what else to write about my problem.
body {
background-color: #596770;
margin-left: 85px; /* Same as the width of the sidenav */
margin-top: 102.5px;
font-size: 18px; /* Increased text to enable scrolling */
padding: 0px 52px 0px 52px;
font-size: 35;
color:white;
font-family: montserrat, sans-serif;
}
table {
}
th {
width: 423px;
height: 273px;
}
.latest img {
max-width: 100%;
}
.About {
margin: -45px 0px 0px -52px;
}
/* Bottom left text */
.bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}
<div class="main">
<h2>Latest News</h2>
<style>
table, th {
border: 1px solid black;
}
table, tr {
border: 0px;
}
</style>
<table class="latest">
<tr>
<!--Latest news-->
<th>
<a href="">
<img src="img/NemID_app_to.jpg.png" alt="NemID"><img/>
</a>
</th>
<td width="61px">
<!--second news-->
<th>Pic2</th>
<td width="61px">
<!--Third news-->
<th>Pic3</th>
</tr>
</table>
</div>
You can use bootstrap and have col tags. When the screen is made smaller the columns will shift down vertically. See an example here: https://getbootstrap.com/docs/3.3/examples/grid/
Are you looking for something like this?
* {
margin: 0;
}
.table {
display: table;
width: 100%
}
.tr {
display: table-row;
}
.td {
display: table-cell;
border: 1px solid #ccc;
padding: 5px
}
#media (max-width: 768px) {
.tr {
display: block;
float: left;
}
.td {
display: block;
}
}
<div class="table">
<div class="tr">
<div class="td">Test 1</div>
<div class="td">Test 2</div>
<div class="td">Test 3</div>
<div class="td">Test 4</div>
<div class="td">Test 5</div>
<div class="td">Test 6</div>
</div>
<div class="tr">
<div class="td">Test 1</div>
<div class="td">Test 2</div>
<div class="td">Test 3</div>
<div class="td">Test 4</div>
<div class="td">Test 5</div>
<div class="td">Test 6</div>
</div>
</div>
When i try to use bootstrap, it is interference with my own CSS. it is possible, to only let the Bootstrap CSS to work on a special ammount of my website.
Looking at your example, you don't want an actual table, but some grid to place the news items. I don't know which browsers you want to support, but CSS Grid layout may be the solution. Then you can define a different grid depening on the screen width.
is this what you are looking for:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
</style>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please upgrade your browser to improve your experience.</p>
<![endif]-->
<div class="container-fluid">
<div class="row">
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4a</div>
<div class="col-sm-2" style="background-color:lavenderblush;">.col-sm-4a</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4a</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4a</div>
<div class="col-sm-2" style="background-color:lavenderblush;">.col-sm-4a</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4a</div>
</div>
<div class="row">
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4b</div>
<div class="col-sm-2" style="background-color:lavenderblush;">.col-sm-4b</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4b</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4b</div>
<div class="col-sm-2" style="background-color:lavenderblush;">.col-sm-4b</div>
<div class="col-sm-2" style="background-color:lavender;">.col-sm-4b</div>
</div>
</div>
<header>
</header>
</body>
</html>
resize the window to see effect
i am trying to make two divisions in html equal in width. they should remain the same width, when they fit into one row, but also when they are aligned below each other.
The example is here: sample
When the two boxes fit into one row, it looks good:
a busy cat http://xn--audiobibelne-olb.wowogiengen.de/div_in_one_row.png
but if they float, it seems like my second div is smaller than the first
two muppets http://xn--audiobibelne-olb.wowogiengen.de/div_in_one_column.png
this is the complete code of the page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<style>
.container {margin:auto;}
.container-inner {position:relative;left:-50%;float:right}
.container-inner ul {position:relative;left:50%}
.container-inner li {display:inline;line-height:normal; }
.container-inner li div {display: table-row;}
.container-inner a,.container-inner a:visited {color:#525252;text-decoration:none}
.container-inner a:hover {text-decoration:underline}
.container-inner li:last-child {border-right:none}
.FarbeNT {background: rgba(255,128,0,0.5)}
.FarbeAT {background: rgba(0,255,0,0.5)}
</style>
</head>
<body>
<div class="container">
<div class="container-inner">
<ul>
<li>
<div class="FarbeAT">
<div style="background-color: rgba(0,0,0, 0.15);">
Das Neue Testament
<img alt="0_AudioBibel_NT_zip.zip" src="audiobibelneu/assets/zip.png"/>
</div>
<div style="">
<p>Evangelien & Apostel</p>
<p>Briefe</p>
<p>Offenbarung</p>
</div>
</div>
</li>
<li style="display: inline">
<div class="FarbeNT">
<div style="background-color: rgba(0,0,0, 0.15)">
Das Alte Testament
<img alt="0_AudioBibel_AT_zip.zip" src="audiobibelneu/assets/zip.png"/>
</div>
<div style="">
<p>Geschichtsbücher</p>
<p>Poetische Bücher</p>
<p>Prophetische Bücher</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>
Edit at 2016-06-03 16:03 GMT+2:
The only problem with my code sample is, that the orange box seems to be a little bit smaller than the green one when they are stacked like in the second picture.
I cant find a way to make both boxes equal in size, say 15em width and 8em height.
I removed this line
.container-inner li div {display: table-row;}
and updated this one:
.container-inner li {display:inline-block;line-height:normal;float:left; }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<style>
.container {margin:auto;}
.container-inner {position:relative;left:-50%;float:right}
.container-inner ul {position:relative;left:50%}
.container-inner li {display:inline-block;line-height:normal;float:left; }
.container-inner a,.container-inner a:visited {color:#525252;text-decoration:none}
.container-inner a:hover {text-decoration:underline}
.container-inner li:last-child {border-right:none}
.FarbeNT {background: rgba(255,128,0,0.5)}
.FarbeAT {background: rgba(0,255,0,0.5)}
</style>
</head>
<body>
<div class="container">
<div class="container-inner">
<ul>
<li>
<div class="FarbeAT">
<div style="background-color: rgba(0,0,0, 0.15);">
Das Neue Testament
<img alt="0_AudioBibel_NT_zip.zip" src="assets/zip.png"/>
</div>
<div style="">
<p>Evangelien & Apostel</p>
<p>Briefe</p>
<p>Offenbarung</p>
</div>
</div>
</li>
<li style="display: inline">
<div class="FarbeNT">
<div style="background-color: rgba(0,0,0, 0.15)">
Das Alte Testament
<img alt="0_AudioBibel_AT_zip.zip" src="assets/zip.png"/>
</div>
<div style="">
<p>Geschichtsbücher</p>
<p>Poetische Bücher</p>
<p>Prophetische Bücher</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>
my stylesheet looks now like that:
.container
{
margin:auto;
}
.container-inner
{
position:relative;
left:-50%;
float:right
}
.container-inner ul
{
position:relative;
left:50%
}
.container-inner li
{
display:inline-block;
line-height:normal;
float:left;
margin-right: 1em;
}
.container-inner a,.container-inner a:visited
{
color:#525252;text-decoration:none
}
.container-inner a:hover
{
text-decoration:underline
}
.container-inner li:last-child
{
border-right:none;
}
hello use display inline block for centering 2 divs with the same width i make it 50% of parent div anyway u can set any size u want and set vertical align to top
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<style>
.container {margin:auto;}
.container-inner ul {font-size: 0; padding: 0; text-align:center; }
.container-inner li {
display:inline-block;
font-size: 13px;
line-height:normal;
text-align: left;
width: 50%;
vertical-align: top;
}
.container-inner a,.container-inner a:visited {color:#525252;text-decoration:none}
.container-inner a:hover {text-decoration:underline}
.container-inner li:last-child {border-right:none}
.FarbeNT {background: rgba(255,128,0,0.5)}
.FarbeAT {background: rgba(0,255,0,0.5)}
</style>
</head>
<body>
<div class="container">
<div class="container-inner">
<ul>
<li>
<div class="FarbeAT">
<div style="background-color: rgba(0,0,0, 0.15);">
Das Neue Testament
<img alt="0_AudioBibel_NT_zip.zip" src="audiobibelneu/assets/zip.png"/>
</div>
<div style="">
<p>Evangelien & Apostel</p>
<p>Briefe</p>
<p>Offenbarung</p>
</div>
</div>
</li>
<li>
<div class="FarbeNT">
<div style="background-color: rgba(0,0,0, 0.15)">
Das Alte Testament
<img alt="0_AudioBibel_AT_zip.zip" src="audiobibelneu/assets/zip.png"/>
</div>
<div>
<p>Geschichtsbücher</p>
<p>Poetische Bücher</p>
<p>Prophetische Bücher</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>
I am trying to create a website but these images I have are not working, they should be under the title, for example, the alcohol photo should be under the alcohol title and nervous system photo should be under the nervous system title.
Here is a screenshot of how it looks like at the moment:
Here is my code at the moment:
HTML: http://hastebin.com/utafabumof.xml
CSS: http://hastebin.com/arefipaguy.css
Thank you for helping if you can. it'd mean a lot.
The images should be inside the same div, for example alcohol image should be in
<div class="science">
<div class="alco">Image for Alco goes Here</div>
<div class="nersys">Image for Nersys goes Here</div>
</div>
Try this.
html file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Science - Portfolio</title>
<link rel="stylesheet" type="text/css" href="styles/science.css"/>
</head>
<body>
<header>
<div class="nav">
<ul>
<li class="home">Home</li>
<li class="about">English</li>
<li class="news">Hosptality & Catering</li>
<li class="contact">Leisure & Tourism</li>
<li class="contact">BTEC Computing</li>
<li class="contact">BTEC Business</li>
<li class="contact">CV</li>
</ul>
</div>
</header>
<div class="science">
<center><h2>Science:</h2></center>
</div>
<div class="center-block">
<div class="alco">
<h4>Alcohol:</h4>
<div class="alcoimage"><img src="images/Science/alcohol.jpg" width="400" height="357" alt=""/></div>
</div>
<div class="nersys">
<h4>Nervous System:</h4>
<div class="alcoimage"><img src="images/Science/NervousSystem.jpg" width="291" height="291" class="nerimage" /></div>
</div>
</div>
<div id="wrapper">
<div id="footer">
<p><center>Contact Me:</center></p>
<p><center>11lanjac#abbeyfield.wilts.sch.uk</center></p>
</div>
</div>
</body>
</html>
And Css file:
....
.science {
padding-top: 30px;
}
.center-block{
text-align: center;
}
.center-block .alco {
display: inline-block;
vertical-align: top;
text-align: center;
padding-right:150px;
}
.center-block .nersys{
display: inline-block;
text-align: center;
padding-left:150px;
}
.alcoimage {
padding-top: 60px;
}
#footer {
background:#40ea3c;
width:100%;
height:80px;
position:absolute;
bottom:0;
left:0;
color: white;
}
ie 8 is adding unnecessary padding to a div. I cannot see any unusual styling here. Can somebody help ?
Html
The div highlighed in blue is the one in context.
.block {
clear: both;
}
.inline {
float: left;
clear: none;
padding: 0;
}
div.content {
padding: 0 18px 0 0;
}
Here is the html code that will reproduce this issue. Sorry about the length. But if you copy this to a html file and open it in ie8, you'll be able to reproduce it.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
.block {
clear: both;
}
div.block .inline:last-child {
float: none;
overflow: hidden;
}
div.content-root {
padding: 0 0 0 18px;
}
.inline {
float: left;
clear: none;
padding: 0;
}
div.content.input-container {
padding-right: 0;
}
div.content {
padding: 0 18px 0 0;
}
</style>
</head>
<body>
<div id="contentPane" style="background-color: transparent; display: block;">
<form>
<div class="block content-root">
<div class="block">
<div class="block">
<div class="block">
<div class="inline">
<label>
<div class="block">
<div class="inline content input-container">
<input type="checkbox" />
</div>
<div class="inline">
<div class="block">
<div class="block">
<div class="inline" style="float: left;">
<div class="block content">
<p>
<span style="font-family: arial; font-size: 11pt;">C. </span>
</p>
</div>
</div>
<div class="inline">
<div class="inline">
<p><span>Correct</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</label>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
The paragraph tag has its own margin by default.
If you write
<p style="margin:0px;">
the 'padding' above and below the word 'Correct' goes.