positioning

(CSS) How position text (with background color) over <img> tag without absolute positioning

落花浮王杯 提交于 2019-12-31 04:03:33
问题 As the title says my code is something like this : <div class=container> <img/> <div>some text with line one, line two , line three </div> </div> the container should have overflow:hidden and my text would be in more than one line , so I need only a small part of my text to appear at the bottom of container, so when user hovers, the full text appears. I want to position text over img WITHOUT absolute positioning. I tried negative margins, but text wouldn't have BG color there. Also tried

Randomly creating and positioning elements exceeds browser window

强颜欢笑 提交于 2019-12-30 07:26:11
问题 Using JQuery I am creating elements and adding them to the body (I've also tried using a DIV and get the same results), the new DIVs that JQuery is creating are being positioned well beyond the window (randomized limits). I pretty much have a blank HTML page, that pulls in JQuery and the script.js for the page. My screen resolution is 1920x1080, so in my JQuery I used those limits to randomize the top and left values to position the blocks; I also use a rotation which I'm not haveing any

Centering one div while another div is floated to the right?

南楼画角 提交于 2019-12-29 09:33:12
问题 Here is my example: <div id="mainContainer"> <div id="itemIWantToCenter"></div> <div id="itemIwantFloatedRight"></div> </div> The mainContainerwidth width is set to 100%. The itemIwantFloatedRight width is set to 300px. Let's say that the itemIWantToCenter has a width of 200px. How would I center that div while floating the other within the container? Thanks! 回答1: You should use a linked stylesheet ofcourse... <div id="mainContainer" style="width:100%; border:solid 1px red;"> <div id=

Extend child div beyond container div

孤人 提交于 2019-12-29 07:24:08
问题 I'm trying to expand this div across with width of the browser. I've read from here that you can use {position:absolute; left: 0; right:0;} to achieve that as in the jsfiddle here: http://jsfiddle.net/bJbgJ/3/ But the problem is that my current #container has a {position:relative;} property, and hence if I apply {position:absolute} to the child div, it would only refer to #container . Is there a way to still extend my child div beyond the #container ? 回答1: I can think of five ways to

Image positioning outside a div

限于喜欢 提交于 2019-12-25 08:33:36
问题 i have set the top of an image to -200px relative to the div that contain that image. for example: The problem is that the div "one" is hidding me the image that i put on "imageup". I tried setting up z-index on #imageup with no succeed. Heres is the specific problem: http://www.ofertasybonos.com/ofertas-automovil As you see the image coches.png is hidden by another div, how i solve this setting a css property on #imageup or on the coches.png 回答1: On #imageup : Change position: relative to

positioning an absolute element in the center of it's relative parent element

假装没事ソ 提交于 2019-12-25 07:34:44
问题 here is my code i want child element to be at bottom and center of it's parent it's in the bottom alright but i cant get it to center i've tried text-align:center ; for parent and margin:0 auto ; for child but it doesn't work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><body> <div style='background-color: yellow; width: 70%; height: 100px; position: relative; text-align:center'> Outer <div style='background-color: green; position: absolute;

Stacking Divs with CSS

情到浓时终转凉″ 提交于 2019-12-25 03:10:30
问题 Im kinda new to CSS have been using tables for my html for years, Im trying to figure out how I can nest divs or stack them inside the content section of a 3 column layout. with tables I'd just do a new <tr> but if I float another div into the content line line it will appear parallel or vertically, when I want to appear beneath. is there another way to do this or am I missing the point of Divs here? basic example code body { margin: 0px; padding: 0px; } #header { background: #438a48; width:

css positioning question

为君一笑 提交于 2019-12-24 18:21:26
问题 I'm trying for the life of me to figure out what should be an excruciatingly simple CSS task: aligning a block of text to the right of an image and vertically positioning the block so it aligns with the bottom of the image; and I'd prefer to not have to declare a height for the containing element as this is for a lengthy image listing and the dimensions will vary (but all with a certain max width/height). I've attempted to define a parent element with "position:relative" containing two left

Vertically center unknown length of text inside a div

≯℡__Kan透↙ 提交于 2019-12-24 14:34:59
问题 I want to center an unknown length of text (ok it's limited to a certain size, but I don't know if it needs one line or two lines) inside a div. Therfore I cannot use line-height . I tried to use display: table-cell , but than the layout is destroyed. I cannot use some tricks with top because I need this for positioning. Here is an example. Mockup: Original code: HTML: <div class="background"> </div> <div class="TileText">MyText - Another long, long, long text</div> CSS: .background{

Center an HTML element with an unknown width to the middle of the screen

喜你入骨 提交于 2019-12-24 00:25:10
问题 If I have a HTML element with an unknown width and height, how can I centre it to exactly the middle of the screen? If it cannot be done with pure CSS, then javascript is OK. 回答1: This answer may or may not fit your situation, depending on how the unkown width/height are being determined. If the exact dimensions are unkown, but they are set with percentages , then you can use this technique: #content { background-color: khaki; /* demo purposes */ position: absolute; height: 20%; top: 50%;