Responsive design: getting content in middle to flow - html

I have a layout where there is a button either side of the screeen.
The content is between the buttons.
How can I make the content display between the buttons when the view is large enough, but drop down and fill remaining space when the content starts to overlap the space between the buttons.
The buttons are a fixed size
nav ul li:first-child {
float: left;
}
nav ul li:last-child {
float: right;
}
nav ul li:first-child,
nav ul li:last-child {
display: table-cell;
}
<nav role="navigation">
<ul>
<li>
<input type="submit" value="Back">
</li>
<li>
<button>next</button>
</li>
</ul>
</nav>
<div id="content">
<input type="text" />
<input type="text" />
<input type="text" />
</div>
<p>"#content" should extract itself from between buttons to next 'line' when page gets smaller, then when that is too small as well, it can start blocking up the inputs.</p>

Fiddle here: https://jsfiddle.net/8g25hjw5/
By doing something like this:
<nav role="navigation">
<ul>
<li>
<input type="submit" value="Back">
</li>
<li>
<button>next</button>
</li>
</ul>
</nav>
<div id="content">
<div>
<input type="text" />
<input type="text" />
<input type="text" />
</div>
</div>
ul {
list-style: none;
}
nav ul li:first-child {
float: left;
}
nav ul li:last-child {
float: right;
}
#content {
display: table;
}
#content div {
display: table-row;
}
#content input {
display: table-cell;
}
#media screen and (max-width: 700px) {
#content {
clear: both;
}
}

Related

Navigation vertical secondary menu does not show over the content (the content below has position:position-relative)

I am making a website for our voluntary association. Still learning web development.
Secondary vertical menue in Navigation menu (for example in activities tab) does not show over the content. I found that it was due to the content below which is possitioned as position:relative (col3 class) when I remove this position:relative the problems solves but I need to keep it as it is for later improvements, you can view the website in this link
http://slsaj.com/panduka/Contact.html
this screen shot shows the issue
actually I have the same problem in Home menue (it is also due to this postion issue coming from javascript and css I guess) hope I would be able to solve it too with the answer to this question
<
<div class="body1">
<div class="main">
<!-- header -->
<header>
<div class="headerbox">
<nav>
<div class="brand">
<h1>xxxxx Assoication in Japan </h1>
</div>
<div id="main-nav3">
<ul id="menu">
<li ></span>
<ul>
</ul>
</li>
<li ><a>Activities<span class="drop-down"></span></a>
<ul>
<li ><a href="" target="_blank" id="events" >Events</a></li>
<li><a href="tharanga.html" id="events2" >Tharanga Magazine</a></li>
<li><a href="Conference.html" >Research Conference</a></li>
</ul>
</li>
<li ></span>
<ul>
</ul>
</li>
<li id="menu_active">Contact<span class="drop-down"></span>
<ul>
</ul>
</li>
<li ></span>
<ul>
</ul>
</li>
</ul>
</div> <!-- menu -->
</nav>
</div>
</header>
<!-- / header -->
<!-- content -->
<article id="content">
<div class="wrapper">
<div class="box1">
<div class="line1 wrapper">
<section class="col1">
<h2><strong>O</strong>ur<span> Details</span></h2>
<strong class="address">
President:<br>
Telephone:<br>
E-Mail:<br>
Secretary:<br>
E-Mail:<br> <br>
Fb:
</strong>
Mr. xxxx<br>
080<br>
xxxx[at]gmail.com <br>
Ms. xxxxx<br>
xxxx[at]gmail.com <br> <br>
#xxxxxxxxx
</section>
<section class="col2 pad_left1"> <!-- This is the cause for this problem ***** -->
<h2 class="color2"><strong>S</strong>ubcribe to<span> email database</span></h2>
<p class="pad_bot1">
You can subcribe to out email database by filling the following form <br>
Subcribe !
</p>
</section>
</div>
</div>
</div>
<!-- This col2 position:relative is the cause for this problem ***** -->
.col2 {margin:0 6px;width:560px;position:relative}
#main-nav3 {
float: left;
width: 700px;
z-index: 30;
}
#main-nav3 ul {
font-size:12px;
list-style: none;
}
#main-nav3 ul li {
float: left;
}
#main-nav3 ul li:first-child {
border: none;
}
#main-nav3 ul li a {
display: block;
position: relative;
width: auto;
text-decoration: none;
font-size:17.8px;
}
#main-nav3 ul li a span.drop-down {
}
#main-nav3 ul li:hover {
background: pink;
}
#main-nav3 ul li ul {
display: none;
}
#main-nav3 ul li:hover ul {
background: brown;
display: block;
position: absolute;
}
#main-nav3 ul li ul li {
float: none;
display: block;
border-left: none;
position: relative; z-index:10;
}
#main-nav3 ul li ul li a {
width: auto;
border-top: dotted 1px #7dad16;
color: yellow;
In the .headerbox css class, opacity: 0.9; is causing the issue. comment that out.
also in #main-nav3 ul li ul {...} add z-index:10; which will fix the dropdown menu issue.

Unhide div when checkbox is checked

I am trying to create a responsive navbar, so when you click a hidden checkbox the content unhides.
The problem is, I can't get the "checked" css to actually pick up and do anything.
Example to run here: http://codepen.io/anon/pen/KNvvZy
CSS:
#nav-hidden{background: red; display: none;}
#navigation-mobile{display:none;}
/* DESKTOP */
#media only screen and (max-width: 1200px) {
#navigation-mobile {display: block;}
#menu-toggle:checked ~ #nav-hidden {
opacity: 1;
height: 100vh;
visibility: visible;
}
.label-toggle {
cursor: pointer;
display: block;
float: right;
}
}
HTML:
<div id="navigation-mobile">
<input type="checkbox" id="menu-toggle">
<label for="menu-toggle" class="label-toggle"></label>
</input>
<div id="nav-hidden">
<ul>
<li>test</li>
<li>test</li>
</ul>
</div>
</div>
In your example, on the original state you have:
#nav-hidden{display:none;}
So, you'll need to reset it on :checked state:
#menu-toggle:checked ~ #nav-hidden {display:block;}
Also want to point out that, you can animate height, opacity, visibility etc., but you can't animate display property.
The <input> element is a self-closing tag, you can do <input> or <input />, but you can't do <input></input>.
#nav-hidden {
display: none;
}
#menu-toggle:checked ~ #nav-hidden {
display: block;
}
<div id="navigation-mobile">
<input type="checkbox" id="menu-toggle">
<label for="menu-toggle" class="label-toggle"></label>
<div id="nav-hidden">
<ul>
<li>test</li>
<li>test</li>
</ul>
</div>
</div>

html form submit in navigation bar

Need advice on html as i am not expert on this.
I need to display following form buttons on a navigation bar on top of a web page but they are coming on different lines. I want this to be responsive so for smaller screens they adjust on different lines but if enough area , should display on nav bar in a single line. Tried few css but was not able to get it right.
Suggestion....
<body class="body">
<header>
<nav>
<ul>
<li><form action="/create" ><button type="submit">Create</button></form></li>
<li><form action="/update" ><button type="submit">Update</button></form></li>
<li><form action="/delete" ><button type="submit">Delete</button></form></li>
</ul>
</nav>
</header>
<div>
</div>
</body>
You Add CSS like this
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
<body class="body">
<header>
<nav>
<ul>
<li><form action="/create" ><button type="submit">Create</button></form></li>
<li><form action="/update" ><button type="submit">Update</button></form></li>
<li><form action="/delete" ><button type="submit">Delete</button></form></li>
</ul>
</nav>
</header>
<div>
</div>
</body>
You can use:
li, form { display: inline; }

Css floating li but not ul

Hi I try to float my li but not my ul
<form name="contactform" action="send_email.php" method="post">
<ul>
<li><p>Email : </p> </li>
<li><input type="text" class="entry" name="email" size="30" id="input_email"> </li>
<li><span id=icon_email></span></li>
</ul>
<ul>
<li><p>Nom/Prénom/Pseudo : </p></li>
<li><input type="text" class="entry" name="name" size="30" id="input_name"></li>
<li><span id=icon_name></span></li>
</ul>
<ul>
<li><p>Message : </p></li>
<li><textarea rows="6" cols="50" class="textarea" name="body" id="input_body"></textarea> </li>
<li><span id=icon_body></span></li>
</ul>
<input type="submit" value="Envoyer un email" class="button pure_bleu" id="button_send_email">
</form>
so in my css I have :
form ul li {
float: left;
}
So, the result is like :
SO I would like that block : li are float but not ul
Thanks
But semantically you are using the wrong html elements
ul is an Unordered List, replace it with a div
p is a paragraph replace it with a span
li is an item list
Structuring your html correctly will make things easier for you. Look at how easy it is to understand a well structured html
http://fiddle.jshell.net/4TzZv/16/
Leo
Maybe like this?
http://jsfiddle.net/JVNPN/3/
form ul li {
float: left;
line-height: 24px;
list-style: none;
}
form ul {
clear: both;
}
You can do it in this way also
http://jsfiddle.net/anjum121/JVNPN/1/
form ul li {
display:inline-block;
line-height: 24px;
vertical-align: middle;
list-style: none;}
form ul{
display:block
}

display: inline; fails when <form> is present

display: inline; fails when <form> is present
its not lining up side by side.
ul#custom {
float:right;
width:100%;
padding:0;
margin:0;
list-style-type:none;
}
#custom li{
display: inline;
}
<ul id="custom"><li>
<form name="form1" method="post" action="checklogin.php">
<label for="field_1">Login ID (Your Email)</label>
<input type="text" name="myusername" id="field_1" class="short" />
<label for="field_1">Password</label>
<input type="password" name="mypassword" id="field_1" class="short" />
<input type="submit" class="submit" value="Login" />
</form>
</li> <li> **should appear right beside the login form not under it. **</li></ul>
ul li { display:inline-block; }
Works perfect.
Add:
#custom form { display: inline; }
<form> is a block level element. Also I'd suggest just using:
#custom { ... }
instead of:
ul#custom { ... }
You need to make the form inline.
#custom li form{
display:inline;
}
You could achieve this by giving your ul a fixed width and floating your li
ul#custom {
width:1000px;
padding:0;
margin:0;
list-style-type:none;
}
#custom li{
display: inline; float: left;
}