Rapid urbanization worldwide has led to a significant increase in the urban population, resulting in heightened pressure on urban pedestrian traffic systems. The recent Itaewon stampede, which occurred on a ramp, has drawn attention to the study of urban pedestrian transportation systems again. As a common mode of pedestrian traffic, there remains a lack of understanding regarding how crowd density and ramps impact pedestrian walking characteristics, specifically, the step length, step frequency, and step duration. To address this gap, we conducted a single-file pedestrian flow experiment with varying slope angles (0 degrees, 3 degrees, 5 degrees, 7 degrees, 9 degrees, 12 degrees, 17 degrees,22 degrees, 27 degrees) to investigate the effects of slope angle and headway on stepping behaviors. Our main findings are as follows: The headway divides pedestrian stepping into free, weakly constrained, and strongly constrained regimes, with the headway thresholds for each regime being influenced by changes in slope angle. When walking under free conditions, whether uphill or downhill, pedestrians tend to increase their step length and decrease their step frequency on gentle slope angles (less than 5 degrees). Additionally, for each slope angle, the step length and duration of uphill walking are greater than those of downhill walking; however, the step frequency during downhill walking is greater than that during uphill walking. Based on these findings, we have incorporated stepping behaviors into the social force model, allowing for the simultaneous reproduction of the primary dynamics and stepping characteristics of pedestrian flow. The model has been validated in a single-file flow scenario, demonstrating that the time-space diagram, fundamental diagram, step length-headway relation, and step frequency-headway relation of the simulation results closely align with experimental findings.